Skip to contentSkip to conversation

commit: Replace commit_top_bs on failure after deleting the block job

PATCH Applied Alberto Garcia 2 participants 2 messages Feb 15, 2019 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 commit: Replace commit_top_bs on failure after deleting the block job

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.

---
 block/commit.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
block/commit.c +3 -1
index 53148e610b..5deb05925b 100644
@@ -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);
 }
 
 
Signature · 1 line
2.11.0
Applied
#1 lore raw

Am 15.02.2019 um 14:49 hat Alberto Garcia geschrieben:

Quoted 9 lines

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.

Thanks, applied to the block branch.

Kevin