aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2023-04-04 11:33:07 -0400
committerKevin Wolf <kwolf@redhat.com>2023-05-10 14:15:13 +0200
commit3edf660a9155848d1d7bc6ad2586ceb0285105e3 (patch)
tree0c2d12be814859368da9f478aa300b20fb7cae0f /util
parent17ac39c3e726173f737bb6cd898c160b406532d4 (diff)
downloadqemu-3edf660a9155848d1d7bc6ad2586ceb0285105e3.zip
qemu-3edf660a9155848d1d7bc6ad2586ceb0285105e3.tar.gz
qemu-3edf660a9155848d1d7bc6ad2586ceb0285105e3.tar.bz2
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 <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20230404153307.458883-1-stefanha@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'util')
-rw-r--r--util/aio-wait.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/aio-wait.c b/util/aio-wait.c
index 98c5acc..b5336cf 100644
--- a/util/aio-wait.c
+++ b/util/aio-wait.c
@@ -82,5 +82,5 @@ void aio_wait_bh_oneshot(AioContext *ctx, QEMUBHFunc *cb, void *opaque)
assert(qemu_get_current_aio_context() == qemu_get_aio_context());
aio_bh_schedule_oneshot(ctx, aio_wait_bh, &data);
- AIO_WAIT_WHILE(ctx, !data.done);
+ AIO_WAIT_WHILE_UNLOCKED(NULL, !data.done);
}