From 723c5d93c51bdb3adbc238ce90195c0864aa6cd5 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Tue, 21 Oct 2014 12:03:53 +0100 Subject: blockdev: add note that block_job_cb() must be thread-safe This function is correct but we should document the constraint that everything must be thread-safe. Emitting QMP events and scheduling BHs are both thread-safe so nothing needs to be done here. Signed-off-by: Stefan Hajnoczi Reviewed-by: Max Reitz Message-id: 1413889440-32577-5-git-send-email-stefanha@redhat.com --- blockdev.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'blockdev.c') diff --git a/blockdev.c b/blockdev.c index 741df9805f..774051b44a 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1929,6 +1929,11 @@ out: static void block_job_cb(void *opaque, int ret) { + /* Note that this function may be executed from another AioContext besides + * the QEMU main loop. If you need to access anything that assumes the + * QEMU global mutex, use a BH or introduce a mutex. + */ + BlockDriverState *bs = opaque; const char *msg = NULL; -- cgit v1.2.3