[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 27/53] vhost: correctly pass error to caller in vhos
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 27/53] vhost: correctly pass error to caller in vhost_dev_enable_notifiers() |
Date: |
Thu, 30 Jul 2015 06:32:42 -0500 |
From: Jason Wang <address@hidden>
We override the error value r in fail_vq, this will cause the caller
can't detect the failure which may cause the caller may disable the
notifiers twice if vhost is failed to start. Fix this by using another
variable to keep track the return value of set_host_notifier().
Fixes b0b3db79559e57db340b292621c397e7a6cdbdc5 ("vhost-net: cleanup
host notifiers at last step")
Cc: address@hidden
Cc: Michael S. Tsirkin <address@hidden>
Signed-off-by: Jason Wang <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
(cherry picked from commit 16617e36b02ebdc83f215d89db9ac00f7d6d6d83)
Signed-off-by: Michael Roth <address@hidden>
---
hw/virtio/vhost.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 54851b7..a7858d3 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -921,7 +921,7 @@ int vhost_dev_enable_notifiers(struct vhost_dev *hdev,
VirtIODevice *vdev)
BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
VirtioBusState *vbus = VIRTIO_BUS(qbus);
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);
- int i, r;
+ int i, r, e;
if (!k->set_host_notifier) {
fprintf(stderr, "binding does not support host notifiers\n");
r = -ENOSYS;
@@ -939,12 +939,12 @@ int vhost_dev_enable_notifiers(struct vhost_dev *hdev,
VirtIODevice *vdev)
return 0;
fail_vq:
while (--i >= 0) {
- r = k->set_host_notifier(qbus->parent, hdev->vq_index + i, false);
- if (r < 0) {
+ e = k->set_host_notifier(qbus->parent, hdev->vq_index + i, false);
+ if (e < 0) {
fprintf(stderr, "vhost VQ %d notifier cleanup error: %d\n", i, -r);
fflush(stderr);
}
- assert (r >= 0);
+ assert (e >= 0);
}
fail:
return r;
--
1.9.1
- [Qemu-devel] [PATCH 17/53] kbd: add brazil kbd keys to qemu, (continued)
- [Qemu-devel] [PATCH 17/53] kbd: add brazil kbd keys to qemu, Michael Roth, 2015/07/30
- [Qemu-devel] [PATCH 20/53] iotests: qcow2 COW with minimal L2 cache size, Michael Roth, 2015/07/30
- [Qemu-devel] [PATCH 01/53] bt-sdp: fix broken uuids power-of-2 calculation, Michael Roth, 2015/07/30
- [Qemu-devel] [PATCH 19/53] qcow2: Set MIN_L2_CACHE_SIZE to 2, Michael Roth, 2015/07/30
- [Qemu-devel] [PATCH 21/53] vmdk: Fix index_in_cluster calculation in vmdk_co_get_block_status, Michael Roth, 2015/07/30
- [Qemu-devel] [PATCH 23/53] sdl2: fix crash in handle_windowevent() when restoring the screen size, Michael Roth, 2015/07/30
- [Qemu-devel] [PATCH 22/53] vmdk: Use vmdk_find_index_in_cluster everywhere, Michael Roth, 2015/07/30
- [Qemu-devel] [PATCH 25/53] i8254: fix out-of-bounds memory access in pit_ioport_read(), Michael Roth, 2015/07/30
- [Qemu-devel] [PATCH 24/53] spice-display: fix segfault in qemu_spice_create_update, Michael Roth, 2015/07/30
- [Qemu-devel] [PATCH 26/53] hw/core: rebase sysbus_get_fw_dev_path() to g_strdup_printf(), Michael Roth, 2015/07/30
- [Qemu-devel] [PATCH 27/53] vhost: correctly pass error to caller in vhost_dev_enable_notifiers(),
Michael Roth <=
- [Qemu-devel] [PATCH 28/53] virtio-ccw: complete handling of guest-initiated resets, Michael Roth, 2015/07/30
- [Qemu-devel] [PATCH 29/53] block: Add bdrv_get_block_status_above, Michael Roth, 2015/07/30
- [Qemu-devel] [PATCH 32/53] block: Fix dirty bitmap in bdrv_co_discard, Michael Roth, 2015/07/30
- [Qemu-devel] [PATCH 34/53] qemu-iotests: Add test case for mirror with unmap, Michael Roth, 2015/07/30
- [Qemu-devel] [PATCH 31/53] mirror: Do zero write on target if sectors not allocated, Michael Roth, 2015/07/30
- [Qemu-devel] [PATCH 33/53] qemu-iotests: Make block job methods common, Michael Roth, 2015/07/30
- [Qemu-devel] [PATCH 30/53] qmp: Add optional bool "unmap" to drive-mirror, Michael Roth, 2015/07/30
- [Qemu-devel] [PATCH 36/53] iotests: add QMP event waiting queue, Michael Roth, 2015/07/30
- [Qemu-devel] [PATCH 35/53] iotests: Use event_wait in wait_ready, Michael Roth, 2015/07/30
- [Qemu-devel] [PATCH 37/53] block/nfs: limit maximum readahead size to 1MB, Michael Roth, 2015/07/30