Received: from eggs.gnu.org ([209.51.188.92]:59317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEF67-0001n5-MN for qemu-devel@nongnu.org; Wed, 10 Apr 2019 11:25:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hEF66-0003rk-PC for qemu-devel@nongnu.org; Wed, 10 Apr 2019 11:25:11 -0400 From: Alberto Garcia Date: Wed, 10 Apr 2019 18:24:29 +0300 Message-Id: <20190410152429.8076-1-berto@igalia.com> Subject: [Qemu-devel] [PATCH for-4.1] commit: Make base read-only if there is an early failure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alberto Garcia , qemu-block@nongnu.org, Kevin Wolf , Max Reitz 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 --- block/commit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/commit.c b/block/commit.c index ba60fef58a..698eda1dfe 100644 --- a/block/commit.c +++ b/block/commit.c @@ -384,6 +384,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. */ -- 2.11.0