Skip to content

Commit

Permalink
blockdev: add note that block_job_cb() must be thread-safe
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Message-id: [email protected]
  • Loading branch information
stefanhaRH committed Nov 3, 2014
1 parent 91fddb0 commit 723c5d9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions blockdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1929,6 +1929,11 @@ void qmp_block_resize(bool has_device, const char *device,

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;

Expand Down

0 comments on commit 723c5d9

Please sign in to comment.