qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] commit: Replace commit_top_bs on failure after deleting the block job
@ 2019-02-15 13:49 Alberto Garcia
  2019-02-15 17:00 ` Kevin Wolf
  0 siblings, 1 reply; 2+ messages in thread
From: Alberto Garcia @ 2019-02-15 13:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alberto Garcia, qemu-block, Kevin Wolf, Max Reitz

If there's an error in commit_start() then the block job must be
deleted before replacing commit_top_bs, otherwise it will fail because
of lack of permissions. This happens since the permission system was
introduced in 8dfba2797761d8a43744e4e6571c8175e448a478.

Fortunately this bug doesn't seem to be possible to reproduce at the
moment without changing the code.

Signed-off-by: Alberto Garcia <berto@igalia.com>
---
 block/commit.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/block/commit.c b/block/commit.c
index 53148e610b..5deb05925b 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -374,10 +374,12 @@ fail:
     if (s->top) {
         blk_unref(s->top);
     }
+    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. */
     if (commit_top_bs) {
         bdrv_replace_node(commit_top_bs, top, &error_abort);
     }
-    job_early_fail(&s->common.job);
 }
 
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] commit: Replace commit_top_bs on failure after deleting the block job
  2019-02-15 13:49 [Qemu-devel] [PATCH] commit: Replace commit_top_bs on failure after deleting the block job Alberto Garcia
@ 2019-02-15 17:00 ` Kevin Wolf
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Wolf @ 2019-02-15 17:00 UTC (permalink / raw)
  To: Alberto Garcia; +Cc: qemu-devel, qemu-block, Max Reitz

Am 15.02.2019 um 14:49 hat Alberto Garcia geschrieben:
> If there's an error in commit_start() then the block job must be
> deleted before replacing commit_top_bs, otherwise it will fail because
> of lack of permissions. This happens since the permission system was
> introduced in 8dfba2797761d8a43744e4e6571c8175e448a478.
> 
> Fortunately this bug doesn't seem to be possible to reproduce at the
> moment without changing the code.
> 
> Signed-off-by: Alberto Garcia <berto@igalia.com>

Thanks, applied to the block branch.

Kevin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-15 17:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-15 13:49 [Qemu-devel] [PATCH] commit: Replace commit_top_bs on failure after deleting the block job Alberto Garcia
2019-02-15 17:00 ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).