[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.2.3 57/87] block-backend: fix edge case in bdrv_next_cleanup()
From: |
Michael Tokarev |
Subject: |
[Stable-8.2.3 57/87] block-backend: fix edge case in bdrv_next_cleanup() where BDS associated to BB changes |
Date: |
Wed, 10 Apr 2024 10:22:30 +0300 |
From: Fiona Ebner <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>
Message-ID: <20240322095009.346989-4-f.ebner@proxmox.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit bac09b093ebbb79e6a7444c7b979c32ca5540132)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/block/block-backend.c b/block/block-backend.c
index 4a419f75fb..86315d62c6 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -677,13 +677,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
- [Stable-8.2.3 43/87] target/hppa: Fix assemble_12a insns for wide mode, (continued)
- [Stable-8.2.3 43/87] target/hppa: Fix assemble_12a insns for wide mode, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 48/87] target/hppa: mask privilege bits in mfia, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 50/87] target/loongarch: Fix qemu-loongarch64 hang when executing 'll.d $t0, $t0, 0', Michael Tokarev, 2024/04/10
- [Stable-8.2.3 49/87] target/hppa: fix do_stdby_e(), Michael Tokarev, 2024/04/10
- [Stable-8.2.3 51/87] docs/conf.py: Remove usage of distutils, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 52/87] target/loongarch: Fix qemu-system-loongarch64 assert failed with the option '-d int', Michael Tokarev, 2024/04/10
- [Stable-8.2.3 54/87] vdpa-dev: Fix initialisation order to restore VDUSE compatibility, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 53/87] target/s390x: Use mutable temporary value for op_ts, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 56/87] block-backend: fix edge case in bdrv_next() where BDS associated to BB changes, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 55/87] block/io: accept NULL qiov in bdrv_pad_request, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 57/87] block-backend: fix edge case in bdrv_next_cleanup() where BDS associated to BB changes,
Michael Tokarev <=
- [Stable-8.2.3 59/87] target/i386/tcg: Enable page walking from MMIO memory, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 61/87] monitor/hmp-cmds-target: Append a space in error message in gpa2hva(), Michael Tokarev, 2024/04/10
- [Stable-8.2.3 58/87] iotests: add test for stream job with an unaligned prefetch read, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 60/87] hw/scsi/scsi-generic: Fix io_timeout property not applying, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 63/87] trans_rvv.c.inc: set vstart = 0 in int scalar move insns, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 62/87] target/riscv/vector_helper.c: set vstart = 0 in GEN_VEXT_VSLIDEUP_VX(), Michael Tokarev, 2024/04/10
- [Stable-8.2.3 65/87] target/riscv: always clear vstart in whole vec move insns, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 66/87] target/riscv/vector_helpers: do early exit when vstart >= vl, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 64/87] target/riscv/vector_helper.c: fix 'vmvr_v' memcpy endianess, Michael Tokarev, 2024/04/10
- [Stable-8.2.3 67/87] target/riscv/vector_helper.c: optimize loops in ldst helpers, Michael Tokarev, 2024/04/10