Commit 065abf9f authored by Alberto Garcia's avatar Alberto Garcia Committed by Kevin Wolf
Browse files

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: default avatarAlberto Garcia <berto@igalia.com>
Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent 265a7e54
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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. */