提交 7540dce9 编写于 作者: D David Hildenbrand 提交者: Caspar Zhang

virtio-mem: Use -ETXTBSY as error code if the device is busy

task #29077503
commit 8d4edcfe78c0008d95effc0c90455cee59e18d10 upstream
Let's be able to distinguish if the device or if memory is busy.

Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
Signed-off-by: NDavid Hildenbrand <david@redhat.com>
Link: https://lore.kernel.org/r/20200507140139.17083-15-david@redhat.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com>
(cherry picked from ccommit 8d4edcfe78c0008d95effc0c90455cee59e18d10)
Signed-off-by: NAlex Shi <alex.shi@linux.alibaba.com>
Reviewed-by: NXunlei Pang <xlpang@linux.alibaba.com>
上级 c9d27e7b
......@@ -893,7 +893,7 @@ static int virtio_mem_send_plug_request(struct virtio_mem *vm, uint64_t addr,
case VIRTIO_MEM_RESP_NACK:
return -EAGAIN;
case VIRTIO_MEM_RESP_BUSY:
return -EBUSY;
return -ETXTBSY;
case VIRTIO_MEM_RESP_ERROR:
return -EINVAL;
default:
......@@ -919,7 +919,7 @@ static int virtio_mem_send_unplug_request(struct virtio_mem *vm, uint64_t addr,
vm->plugged_size -= size;
return 0;
case VIRTIO_MEM_RESP_BUSY:
return -EBUSY;
return -ETXTBSY;
case VIRTIO_MEM_RESP_ERROR:
return -EINVAL;
default:
......@@ -941,7 +941,7 @@ static int virtio_mem_send_unplug_all_request(struct virtio_mem *vm)
atomic_set(&vm->config_changed, 1);
return 0;
case VIRTIO_MEM_RESP_BUSY:
return -EBUSY;
return -ETXTBSY;
default:
return -ENOMEM;
}
......@@ -1557,11 +1557,15 @@ static void virtio_mem_run_wq(struct work_struct *work)
* or we have too many offline memory blocks.
*/
break;
case -EBUSY:
case -ETXTBSY:
/*
* The hypervisor cannot process our request right now
* (e.g., out of memory, migrating) or we cannot free up
* any memory to unplug it (all plugged memory is busy).
* (e.g., out of memory, migrating);
*/
case -EBUSY:
/*
* We cannot free up any memory to unplug it (all plugged memory
* is busy).
*/
case -ENOMEM:
/* Out of memory, try again later. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册