From 3edf660a9155848d1d7bc6ad2586ceb0285105e3 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Tue, 4 Apr 2023 11:33:07 -0400 Subject: aio-wait: avoid AioContext lock in aio_wait_bh_oneshot() There is no need for the AioContext lock in aio_wait_bh_oneshot(). It's easy to remove the lock from existing callers and then switch from AIO_WAIT_WHILE() to AIO_WAIT_WHILE_UNLOCKED() in aio_wait_bh_oneshot(). Document that the AioContext lock should not be held across aio_wait_bh_oneshot(). Holding a lock across aio_poll() can cause deadlock so we don't want callers to do that. This is a step towards getting rid of the AioContext lock. Cc: Paolo Bonzini Signed-off-by: Stefan Hajnoczi Message-Id: <20230404153307.458883-1-stefanha@redhat.com> Reviewed-by: Paolo Bonzini Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- hw/scsi/virtio-scsi-dataplane.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'hw/scsi') diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c index 20bb917..f3214e1 100644 --- a/hw/scsi/virtio-scsi-dataplane.c +++ b/hw/scsi/virtio-scsi-dataplane.c @@ -197,9 +197,7 @@ void virtio_scsi_dataplane_stop(VirtIODevice *vdev) } s->dataplane_stopping = true; - aio_context_acquire(s->ctx); aio_wait_bh_oneshot(s->ctx, virtio_scsi_dataplane_stop_bh, s); - aio_context_release(s->ctx); blk_drain_all(); /* ensure there are no in-flight requests */ -- cgit v1.1