mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-28 21:03:54 -06: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:
parent
3804e3cf54
commit
bce73bc25b
4 changed files with 40 additions and 14 deletions
|
@ -413,8 +413,8 @@ struct BlockDriver {
|
|||
* If both conditions are met, 0 is returned. Otherwise, -errno is returned
|
||||
* and errp is set to an error describing the conflict.
|
||||
*/
|
||||
int (*bdrv_check_perm)(BlockDriverState *bs, uint64_t perm,
|
||||
uint64_t shared, Error **errp);
|
||||
int GRAPH_RDLOCK_PTR (*bdrv_check_perm)(BlockDriverState *bs, uint64_t perm,
|
||||
uint64_t shared, Error **errp);
|
||||
|
||||
/**
|
||||
* Called to inform the driver that the set of cumulative set of used
|
||||
|
@ -426,7 +426,8 @@ struct BlockDriver {
|
|||
* This function is only invoked after bdrv_check_perm(), so block drivers
|
||||
* may rely on preparations made in their .bdrv_check_perm implementation.
|
||||
*/
|
||||
void (*bdrv_set_perm)(BlockDriverState *bs, uint64_t perm, uint64_t shared);
|
||||
void GRAPH_RDLOCK_PTR (*bdrv_set_perm)(
|
||||
BlockDriverState *bs, uint64_t perm, uint64_t shared);
|
||||
|
||||
/*
|
||||
* Called to inform the driver that after a previous bdrv_check_perm()
|
||||
|
@ -436,7 +437,7 @@ struct BlockDriver {
|
|||
* This function can be called even for nodes that never saw a
|
||||
* bdrv_check_perm() call. It is a no-op then.
|
||||
*/
|
||||
void (*bdrv_abort_perm_update)(BlockDriverState *bs);
|
||||
void GRAPH_RDLOCK_PTR (*bdrv_abort_perm_update)(BlockDriverState *bs);
|
||||
|
||||
/**
|
||||
* Returns in @nperm and @nshared the permissions that the driver for @bs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue