aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--block.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/block.c b/block.c
index 3615a68..3308814 100644
--- a/block.c
+++ b/block.c
@@ -4085,21 +4085,20 @@ static int bdrv_inactivate_recurse(BlockDriverState *bs,
}
}
- if (setting_flag) {
+ if (setting_flag && !(bs->open_flags & BDRV_O_INACTIVE)) {
uint64_t perm, shared_perm;
- 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;
}
}
}
+ bs->open_flags |= BDRV_O_INACTIVE;
+
/* Update permissions, they may differ for inactive nodes */
bdrv_get_cumulative_perm(bs, &perm, &shared_perm);
bdrv_check_perm(bs, perm, shared_perm, NULL, &error_abort);