Skip to content

Commit 8d4edcf

Browse files
davidhildenbrandmstsirkin
authored andcommitted
virtio-mem: Use -ETXTBSY as error code if the device is busy
Let's be able to distinguish if the device or if memory is busy. Cc: "Michael S. Tsirkin" <[email protected]> Cc: Pankaj Gupta <[email protected]> Signed-off-by: David Hildenbrand <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 562e08c commit 8d4edcf

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

drivers/virtio/virtio_mem.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ static int virtio_mem_send_plug_request(struct virtio_mem *vm, uint64_t addr,
893893
case VIRTIO_MEM_RESP_NACK:
894894
return -EAGAIN;
895895
case VIRTIO_MEM_RESP_BUSY:
896-
return -EBUSY;
896+
return -ETXTBSY;
897897
case VIRTIO_MEM_RESP_ERROR:
898898
return -EINVAL;
899899
default:
@@ -919,7 +919,7 @@ static int virtio_mem_send_unplug_request(struct virtio_mem *vm, uint64_t addr,
919919
vm->plugged_size -= size;
920920
return 0;
921921
case VIRTIO_MEM_RESP_BUSY:
922-
return -EBUSY;
922+
return -ETXTBSY;
923923
case VIRTIO_MEM_RESP_ERROR:
924924
return -EINVAL;
925925
default:
@@ -941,7 +941,7 @@ static int virtio_mem_send_unplug_all_request(struct virtio_mem *vm)
941941
atomic_set(&vm->config_changed, 1);
942942
return 0;
943943
case VIRTIO_MEM_RESP_BUSY:
944-
return -EBUSY;
944+
return -ETXTBSY;
945945
default:
946946
return -ENOMEM;
947947
}
@@ -1557,11 +1557,15 @@ static void virtio_mem_run_wq(struct work_struct *work)
15571557
* or we have too many offline memory blocks.
15581558
*/
15591559
break;
1560-
case -EBUSY:
1560+
case -ETXTBSY:
15611561
/*
15621562
* The hypervisor cannot process our request right now
1563-
* (e.g., out of memory, migrating) or we cannot free up
1564-
* any memory to unplug it (all plugged memory is busy).
1563+
* (e.g., out of memory, migrating);
1564+
*/
1565+
case -EBUSY:
1566+
/*
1567+
* We cannot free up any memory to unplug it (all plugged memory
1568+
* is busy).
15651569
*/
15661570
case -ENOMEM:
15671571
/* Out of memory, try again later. */

0 commit comments

Comments
 (0)