mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 15:15:46 +00:00
block: Mark bdrv_get_cumulative_perm() and callers GRAPH_RDLOCK
The function reads the parents list, so it needs to hold the graph lock. This happens to result in BlockDriver.bdrv_set_perm() to be called with the graph lock held. For consistency, make it the same for all of the BlockDriver callbacks for updating permissions and annotate the function pointers with GRAPH_RDLOCK_PTR. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-ID: <20230911094620.45040-15-kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
@ -1378,6 +1378,9 @@ static void external_snapshot_action(TransactionAction *action,
|
||||
AioContext *aio_context;
|
||||
uint64_t perm, shared;
|
||||
|
||||
/* TODO We'll eventually have to take a writer lock in this function */
|
||||
GRAPH_RDLOCK_GUARD_MAINLOOP();
|
||||
|
||||
tran_add(tran, &external_snapshot_drv, state);
|
||||
|
||||
/* 'blockdev-snapshot' and 'blockdev-snapshot-sync' have similar
|
||||
@ -2521,6 +2524,9 @@ void qmp_block_commit(const char *job_id, const char *device,
|
||||
int job_flags = JOB_DEFAULT;
|
||||
uint64_t top_perm, top_shared;
|
||||
|
||||
/* TODO We'll eventually have to take a writer lock in this function */
|
||||
GRAPH_RDLOCK_GUARD_MAINLOOP();
|
||||
|
||||
if (!has_speed) {
|
||||
speed = 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user