qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, qemu-stable@nongnu.org, hreitz@redhat.com,
	kwolf@redhat.com, fam@euphon.net, stefanha@redhat.com,
	t.lamprecht@proxmox.com, w.bumiller@proxmox.com
Subject: [PATCH v3 3/4] block-backend: fix edge case in bdrv_next_cleanup() where BDS associated to BB changes
Date: Fri, 22 Mar 2024 10:50:08 +0100	[thread overview]
Message-ID: <20240322095009.346989-4-f.ebner@proxmox.com> (raw)
In-Reply-To: <20240322095009.346989-1-f.ebner@proxmox.com>

Same rationale as for commit "block-backend: fix edge case in
bdrv_next() where BDS associated to BB changes". The block graph might
change between the bdrv_next() call and the bdrv_next_cleanup() call,
so it could be that the associated BDS is not the same that was
referenced previously anymore. Instead, rely on bdrv_next() to set
it->bs to the BDS it referenced and unreference that one in any case.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

New in v3.

 block/block-backend.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index 28af1eb17a..db6f9b92a3 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -663,13 +663,10 @@ void bdrv_next_cleanup(BdrvNextIterator *it)
     /* Must be called from the main loop */
     assert(qemu_get_current_aio_context() == qemu_get_aio_context());
 
-    if (it->phase == BDRV_NEXT_BACKEND_ROOTS) {
-        if (it->blk) {
-            bdrv_unref(blk_bs(it->blk));
-            blk_unref(it->blk);
-        }
-    } else {
-        bdrv_unref(it->bs);
+    bdrv_unref(it->bs);
+
+    if (it->phase == BDRV_NEXT_BACKEND_ROOTS && it->blk) {
+        blk_unref(it->blk);
     }
 
     bdrv_next_reset(it);
-- 
2.39.2




  parent reply	other threads:[~2024-03-22  9:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-22  9:50 [PATCH v3 0/4] fix two edge cases related to stream block jobs Fiona Ebner
2024-03-22  9:50 ` [PATCH v3 1/4] block/io: accept NULL qiov in bdrv_pad_request Fiona Ebner
2024-03-25 19:56   ` Stefan Hajnoczi
2024-03-22  9:50 ` [PATCH v3 2/4] block-backend: fix edge case in bdrv_next() where BDS associated to BB changes Fiona Ebner
2024-03-25 20:06   ` Stefan Hajnoczi
2024-03-26 12:44   ` Kevin Wolf
2024-06-03 14:17     ` Fiona Ebner
2024-06-03 16:21       ` Kevin Wolf
2024-06-04  7:58         ` Fiona Ebner
2024-06-04 15:28           ` Kevin Wolf
2024-06-05 14:14             ` Fiona Ebner
2024-03-22  9:50 ` Fiona Ebner [this message]
2024-03-25 20:07   ` [PATCH v3 3/4] block-backend: fix edge case in bdrv_next_cleanup() " Stefan Hajnoczi
2024-03-22  9:50 ` [PATCH v3 4/4] iotests: add test for stream job with an unaligned prefetch read Fiona Ebner
2024-03-25 20:09   ` Stefan Hajnoczi
2024-03-25 20:11 ` [PATCH v3 0/4] fix two edge cases related to stream block jobs Stefan Hajnoczi
2024-03-26 12:53   ` 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=20240322095009.346989-4-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=fam@euphon.net \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=t.lamprecht@proxmox.com \
    --cc=w.bumiller@proxmox.com \
    /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).