aboutsummaryrefslogtreecommitdiff
path: root/block/commit.c
diff options
context:
space:
mode:
authorAlberto Garcia <berto@igalia.com>2019-04-29 15:51:08 +0200
committerKevin Wolf <kwolf@redhat.com>2019-04-30 15:29:00 +0200
commit065abf9f2b4ed61017d31da8a94f1ddc6f54beb5 (patch)
treeed5c3969ec02558d38867673b176af04c9beb75c /block/commit.c
parent265a7e54efad246f4bde63f77aee6311f436f5f1 (diff)
commit: Make base read-only if there is an early failure
You can reproduce this by passing an invalid filter-node-name (like "1234") to block-commit. In this case the base image is put in read-write mode but is never reset back to read-only. Signed-off-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/commit.c')
-rw-r--r--block/commit.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/block/commit.c b/block/commit.c
index 08204fa6f8..27537d995b 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -383,6 +383,9 @@ fail:
if (s->top) {
blk_unref(s->top);
}
+ if (s->base_read_only) {
+ bdrv_reopen_set_read_only(base, true, NULL);
+ }
job_early_fail(&s->common.job);
/* commit_top_bs has to be replaced after deleting the block job,
* otherwise this would fail because of lack of permissions. */