aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2017-05-04 18:52:38 +0200
committerKevin Wolf <kwolf@redhat.com>2017-05-11 12:08:24 +0200
commitcfa1a5723f0fc8eb6563fb1d19c206fd5e40cd41 (patch)
tree1b9b918ff73c1e5b7504c084ce91f919cdc86a49 /block.c
parent4417ab7adf1613799054be5afedf810fc2524ee8 (diff)
downloadqemu-cfa1a5723f0fc8eb6563fb1d19c206fd5e40cd41.zip
qemu-cfa1a5723f0fc8eb6563fb1d19c206fd5e40cd41.tar.gz
qemu-cfa1a5723f0fc8eb6563fb1d19c206fd5e40cd41.tar.bz2
block: Drop permissions when migration completes
With image locking, permissions affect other qemu processes as well. We want to be sure that the destination can run, so let's drop permissions on the source when migration completes. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/block.c b/block.c
index c8e6de2..444a52e 100644
--- a/block.c
+++ b/block.c
@@ -4019,7 +4019,7 @@ void bdrv_invalidate_cache_all(Error **errp)
static int bdrv_inactivate_recurse(BlockDriverState *bs,
bool setting_flag)
{
- BdrvChild *child;
+ BdrvChild *child, *parent;
int ret;
if (!setting_flag && bs->drv->bdrv_inactivate) {
@@ -4038,6 +4038,16 @@ static int bdrv_inactivate_recurse(BlockDriverState *bs,
if (setting_flag) {
bs->open_flags |= BDRV_O_INACTIVE;
+
+ QLIST_FOREACH(parent, &bs->parents, next_parent) {
+ if (parent->role->inactivate) {
+ ret = parent->role->inactivate(parent);
+ if (ret < 0) {
+ bs->open_flags &= ~BDRV_O_INACTIVE;
+ return ret;
+ }
+ }
+ }
}
return 0;
}