mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
block: Mark bdrv_skip_implicit_filters() and callers GRAPH_RDLOCK
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_skip_implicit_filters() need to hold a reader lock for the graph because it calls bdrv_filter_child(), which accesses bs->file/backing. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-ID: <20231027155333.420094-8-kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
372b69f503
commit
430da832af
4 changed files with 32 additions and 16 deletions
14
blockdev.c
14
blockdev.c
|
@ -1746,10 +1746,10 @@ static void drive_backup_action(DriveBackup *backup,
|
|||
assert(format);
|
||||
if (source) {
|
||||
/* Implicit filters should not appear in the filename */
|
||||
BlockDriverState *explicit_backing =
|
||||
bdrv_skip_implicit_filters(source);
|
||||
BlockDriverState *explicit_backing;
|
||||
|
||||
bdrv_graph_rdlock_main_loop();
|
||||
explicit_backing = bdrv_skip_implicit_filters(source);
|
||||
bdrv_refresh_filename(explicit_backing);
|
||||
bdrv_graph_rdunlock_main_loop();
|
||||
|
||||
|
@ -3108,16 +3108,18 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp)
|
|||
bdrv_img_create(arg->target, format,
|
||||
NULL, NULL, NULL, size, flags, false, &local_err);
|
||||
} else {
|
||||
/* Implicit filters should not appear in the filename */
|
||||
BlockDriverState *explicit_backing =
|
||||
bdrv_skip_implicit_filters(target_backing_bs);
|
||||
BlockDriverState *explicit_backing;
|
||||
|
||||
switch (arg->mode) {
|
||||
case NEW_IMAGE_MODE_EXISTING:
|
||||
break;
|
||||
case NEW_IMAGE_MODE_ABSOLUTE_PATHS:
|
||||
/* create new image with backing file */
|
||||
/*
|
||||
* Create new image with backing file.
|
||||
* Implicit filters should not appear in the filename.
|
||||
*/
|
||||
bdrv_graph_rdlock_main_loop();
|
||||
explicit_backing = bdrv_skip_implicit_filters(target_backing_bs);
|
||||
bdrv_refresh_filename(explicit_backing);
|
||||
bdrv_graph_rdunlock_main_loop();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue