summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorFam Zheng2017-03-14 03:30:50 +0100
committerKevin Wolf2017-03-17 12:54:06 +0100
commitc1cef67251d3e6ae275c0898ccf4cbcfe85d4e0b (patch)
treee66118024fe5e6618ffe966901a05862950da8e4 /block
parentfile-posix: Don't leak fd in hdev_get_max_segments (diff)
downloadqemu-c1cef67251d3e6ae275c0898ccf4cbcfe85d4e0b.tar.gz
qemu-c1cef67251d3e6ae275c0898ccf4cbcfe85d4e0b.tar.xz
qemu-c1cef67251d3e6ae275c0898ccf4cbcfe85d4e0b.zip
block: Always call bdrv_child_check_perm first
bdrv_child_set_perm alone is not very usable because the caller must call bdrv_child_check_perm first. This is already encapsulated conveniently in bdrv_child_try_set_perm, so remove the other prototypes from the header and fix the one wrong caller, block/mirror.c. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/mirror.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/block/mirror.c b/block/mirror.c
index 4f3a5cb310..ca4baa510a 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -574,7 +574,8 @@ static void mirror_exit(BlockJob *job, void *opaque)
* valid. Also give up permissions on mirror_top_bs->backing, which might
* block the removal. */
block_job_remove_all_bdrv(job);
- bdrv_child_set_perm(mirror_top_bs->backing, 0, BLK_PERM_ALL);
+ bdrv_child_try_set_perm(mirror_top_bs->backing, 0, BLK_PERM_ALL,
+ &error_abort);
bdrv_replace_node(mirror_top_bs, backing_bs(mirror_top_bs), &error_abort);
/* We just changed the BDS the job BB refers to (with either or both of the
@@ -1245,7 +1246,8 @@ fail:
block_job_unref(&s->common);
}
- bdrv_child_set_perm(mirror_top_bs->backing, 0, BLK_PERM_ALL);
+ bdrv_child_try_set_perm(mirror_top_bs->backing, 0, BLK_PERM_ALL,
+ &error_abort);
bdrv_replace_node(mirror_top_bs, backing_bs(mirror_top_bs), &error_abort);
}