[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/16] virtio-blk: Fix rollback path in virtio_blk_data_plane_star
From: |
Michael S. Tsirkin |
Subject: |
[PULL 08/16] virtio-blk: Fix rollback path in virtio_blk_data_plane_start() |
Date: |
Fri, 14 May 2021 12:04:26 -0400 |
From: Greg Kurz <groug@kaod.org>
When dataplane multiqueue support was added in QEMU 2.7, the path
that would rollback guest notifiers assignment in case of error
simply got dropped.
Later on, when Error was added to blk_set_aio_context() in QEMU 4.1,
another error path was introduced, but it ommits to rollback both
host and guest notifiers.
It seems cleaner to fix the rollback path in one go. The patch is
simple enough that it can be adjusted if backported to a pre-4.1
QEMU.
Fixes: 51b04ac5c6a6 ("virtio-blk: dataplane multiqueue support")
Cc: stefanha@redhat.com
Fixes: 97896a4887a0 ("block: Add Error to blk_set_aio_context()")
Cc: kwolf@redhat.com
Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20210407143501.244343-2-groug@kaod.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/block/dataplane/virtio-blk.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
index e9050c8987..d7b5c95d26 100644
--- a/hw/block/dataplane/virtio-blk.c
+++ b/hw/block/dataplane/virtio-blk.c
@@ -207,7 +207,7 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev)
virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false);
virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i);
}
- goto fail_guest_notifiers;
+ goto fail_host_notifiers;
}
}
@@ -221,7 +221,7 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev)
aio_context_release(old_context);
if (r < 0) {
error_report_err(local_err);
- goto fail_guest_notifiers;
+ goto fail_aio_context;
}
/* Process queued requests before the ones in vring */
@@ -245,6 +245,13 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev)
aio_context_release(s->ctx);
return 0;
+ fail_aio_context:
+ for (i = 0; i < nvqs; i++) {
+ virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false);
+ virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i);
+ }
+ fail_host_notifiers:
+ k->set_guest_notifiers(qbus->parent, nvqs, false);
fail_guest_notifiers:
/*
* If we failed to set up the guest notifiers queued requests will be
--
MST
- [PULL 00/16] pc,pci,virtio: bugfixes, improvements, Michael S. Tsirkin, 2021/05/14
- [PULL 01/16] amd_iommu: Fix pte_override_page_mask(), Michael S. Tsirkin, 2021/05/14
- [PULL 03/16] hw/virtio: Pass virtio_feature_get_config_size() a const argument, Michael S. Tsirkin, 2021/05/14
- [PULL 04/16] virtio-blk: Constify VirtIOFeature feature_sizes[], Michael S. Tsirkin, 2021/05/14
- [PULL 05/16] virtio-net: Constify VirtIOFeature feature_sizes[], Michael S. Tsirkin, 2021/05/14
- [PULL 07/16] pc-dimm: remove unnecessary get_vmstate_memory_region() method, Michael S. Tsirkin, 2021/05/14
- [PULL 08/16] virtio-blk: Fix rollback path in virtio_blk_data_plane_start(),
Michael S. Tsirkin <=
- [PULL 09/16] virtio-blk: Configure all host notifiers in a single MR transaction, Michael S. Tsirkin, 2021/05/14
- [PULL 10/16] virtio-scsi: Set host notifiers and callbacks separately, Michael S. Tsirkin, 2021/05/14
- [PULL 11/16] virtio-scsi: Configure all host notifiers in a single MR transaction, Michael S. Tsirkin, 2021/05/14
- [PULL 12/16] checkpatch: Fix use of uninitialized value, Michael S. Tsirkin, 2021/05/14
- [PULL 15/16] vhost-vdpa: Make vhost_vdpa_get_device_id() static, Michael S. Tsirkin, 2021/05/14
- [PULL 06/16] amd_iommu: fix wrong MMIO operations, Michael S. Tsirkin, 2021/05/14
- [PULL 02/16] x86: acpi: use offset instead of pointer when using build_header(), Michael S. Tsirkin, 2021/05/14
- [PULL 14/16] hw/virtio: enable ioeventfd configuring for mmio, Michael S. Tsirkin, 2021/05/14
- [PULL 13/16] hw/smbios: support for type 41 (onboard devices extended information), Michael S. Tsirkin, 2021/05/14
- [PULL 16/16] Fix build with 64 bits time_t, Michael S. Tsirkin, 2021/05/14