qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 1/3] commit: Fix completion with extra reference
Date: Fri,  9 Jun 2017 13:50:01 +0200	[thread overview]
Message-ID: <1497009003-25794-2-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1497009003-25794-1-git-send-email-kwolf@redhat.com>

commit_complete() can't assume that after its block_job_completed() the
job is actually immediately freed; someone else may still be holding
references. In this case, the op blockers on the intermediate nodes make
the graph reconfiguration in the completion code fail.

Call block_job_remove_all_bdrv() manually so that we know for sure that
any blockers on intermediate nodes are given up.

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/commit.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/block/commit.c b/block/commit.c
index af6fa68..8c09c3d 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -119,6 +119,13 @@ static void commit_complete(BlockJob *job, void *opaque)
     }
     g_free(s->backing_file_str);
     blk_unref(s->top);
+
+    /* If there is more than one reference to the job (e.g. if called from
+     * block_job_finish_sync()), block_job_completed() won't free it and
+     * therefore the blockers on the intermediate nodes remain. This would
+     * cause bdrv_set_backing_hd() to fail. */
+    block_job_remove_all_bdrv(job);
+
     block_job_completed(&s->common, ret);
     g_free(data);
 
-- 
1.8.3.1

  reply	other threads:[~2017-06-09 11:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-09 11:50 [Qemu-devel] [PATCH 0/3] commit: Fix completion with extra reference Kevin Wolf
2017-06-09 11:50 ` Kevin Wolf [this message]
2017-06-09 12:05   ` [Qemu-devel] [PATCH 1/3] " Eric Blake
2017-06-09 14:18   ` [Qemu-devel] [Qemu-block] " Max Reitz
2017-06-09 11:50 ` [Qemu-devel] [PATCH 2/3] qemu-iotests: Allow starting new qemu after cleanup Kevin Wolf
2017-06-09 12:05   ` Eric Blake
2017-06-09 14:20   ` [Qemu-devel] [Qemu-block] " Max Reitz
2017-06-09 11:50 ` [Qemu-devel] [PATCH 3/3] qemu-iotests: Test exiting qemu with running job Kevin Wolf
2017-06-09 12:14   ` Eric Blake
2017-06-09 12:58     ` Kevin Wolf
2017-06-09 14:16       ` Eric Blake
2017-06-09 15:55         ` Kevin Wolf
2017-06-09 17:07           ` Eric Blake
2017-06-09 14:10   ` [Qemu-devel] [Qemu-block] " Max Reitz
2017-06-09 14:24     ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1497009003-25794-2-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).