Re: [PATCH v4 00/48] block: do not drain while holding the graph lock

2025-07-15 Thread Fiona Ebner
Am 14.07.25 um 15:43 schrieb Kevin Wolf: > Am 01.07.2025 um 19:16 hat Kevin Wolf geschrieben: >> Am 30.05.2025 um 17:10 hat Fiona Ebner geschrieben: >>> This series is an attempt to fix a deadlock issue reported by Andrey >>> here [3]. >>> >>> bdrv_d

[PATCH v3 0/2] block/qapi: include child references in block device info

2025-07-02 Thread Fiona Ebner
Changes in v3: * Add patch to make @node-name non-optional for @BlockDeviceInfo. * Drop superfluous check for child->bs being non-NULL. * Make @node-name non-optional and expect it to be set. * Use 'block/qapi' rather than just 'block' as commit title prefix. Fiona

[PATCH v3 1/2] block/qapi: include child references in block device info

2025-07-02 Thread Fiona Ebner
rottle node was explicitly added (as the mirror target). In other scenarios, it could be useful to follow the backing chain. Note that iotests 191 and 273 use _filter_img_info, so the 'children' information is filtered out there. Signed-off-by: Fiona Ebner --- Changes in v3: * D

[PATCH v3 2/2] block/qapi: make @node-name in @BlockDeviceInfo non-optional

2025-07-02 Thread Fiona Ebner
Since commit 15489c769b ("block: auto-generated node-names"), if the node name of a block driver state is not explicitly specified, it will be auto-generated. Signed-off-by: Fiona Ebner --- New in v3. block/qapi.c | 4 +--- qapi/block-core.json | 2 +- 2 files changed, 2

Re: [PATCH v2] block: include child references in block device info

2025-07-02 Thread Fiona Ebner
Am 02.07.25 um 11:13 schrieb Kevin Wolf: > Am 01.07.2025 um 18:21 hat Fiona Ebner geschrieben: >> +## >> +# @BlockdevChild: >> +# >> +# @child: The name of the child, for example 'file' or 'backing'. >> +# >> +# @node-name: The nam

[PATCH v2] block: include child references in block device info

2025-07-01 Thread Fiona Ebner
rottle node was explicitly added (as the mirror target). In other scenarios, it could be useful to follow the backing chain. Note that iotests 191 and 273 use _filter_img_info, so the 'children' information is filtered out there. Signed-off-by: Fiona Ebner --- Changes in v2: * Return

Re: [PATCH] block: include 'file' child node name in block device info

2025-07-01 Thread Fiona Ebner
Am 01.07.25 um 15:04 schrieb Hanna Czenczek: > On 30.06.25 16:06, Fiona Ebner wrote: >> In combination with using a throttle filter to enforce IO limits for >> a guest device, knowing the 'file' child of a block device can be >> useful. If the throttle filter is on

[PATCH] block: include 'file' child node name in block device info

2025-06-30 Thread Fiona Ebner
rottle node was explicitly added (as the mirror target). Signed-off-by: Fiona Ebner --- block/qapi.c | 4 qapi/block-core.json | 4 tests/qemu-iotests/184.out | 1 + tests/qemu-iotests/191.out | 8 tests/qemu-iotests/273.out | 2 ++ 5 files changed, 19 in

[PATCH 1/4] include/block/block_int-common: document when resize callback is used

2025-06-30 Thread Fiona Ebner
The 'resize' callback is only called by bdrv_parent_cb_resize() which is only called by bdrv_co_write_req_finish() to notify the parent(s) that the child was resized. Signed-off-by: Fiona Ebner --- include/block/block_int-common.h | 3 +++ 1 file changed, 3 insertions(+) diff --git

[PATCH 3/4] block: implement 'resize' callback for child_of_bds class

2025-06-30 Thread Fiona Ebner
If a node below a filter node is resized, the size of the filter node is now also refreshed (recursively for filter parents). Signed-off-by: Fiona Ebner --- block.c | 12 include/block/block_int-common.h | 2 +- 2 files changed, 13 insertions(+), 1

[PATCH 2/4] block: make bdrv_co_parent_cb_resize() a proper IO API function

2025-06-30 Thread Fiona Ebner
In preparation for calling it via the bdrv_child_cb_resize() callback that will be added by the next commit. Rename it to include the "_co_" part while at it. Signed-off-by: Fiona Ebner --- block/io.c | 9 +++-- include/block/block_int-io.h | 6 ++ 2 files

[PATCH 0/4] refresh filter parents when child was resized

2025-06-30 Thread Fiona Ebner
Resizing a node below a filter would result in the filter still reporting the old size. Implement a 'resize' callback for the child_of_bds class, that refreshes filter parents recursively. Fiona Ebner (4): include/block/block_int-common: document when resize callback is used b

[PATCH 4/4] iotests: add test for resizing a node below filters

2025-06-30 Thread Fiona Ebner
Signed-off-by: Fiona Ebner --- tests/qemu-iotests/tests/resize-below-filter | 73 +++ .../tests/resize-below-filter.out | 5 ++ 2 files changed, 78 insertions(+) create mode 100755 tests/qemu-iotests/tests/resize-below-filter create mode 100644 tests/qemu-iotests

Re: [PATCH 1/2] block/rbd: support selected key-value-pairs via QAPI

2025-06-20 Thread Fiona Ebner
Am 19.06.25 um 23:20 schrieb Ilya Dryomov: > On Thu, Jun 19, 2025 at 8:38 PM Ilya Dryomov wrote: >> >> On Mon, Jun 16, 2025 at 2:38 PM Fiona Ebner wrote: >>> >>> Am 16.06.25 um 12:28 schrieb Ilya Dryomov: >>>> On Mon, Jun 16, 2025 at 11:52 AM Daniel P

Re: [PATCH 2/2] block/rbd: support keyring option via QAPI

2025-06-16 Thread Fiona Ebner
Am 16.06.25 um 11:34 schrieb Ilya Dryomov: > On Thu, May 15, 2025 at 1:29 PM Fiona Ebner wrote: >> >> In Proxmox VE, it is not always required to have a dedicated Ceph >> configuration file, and using the 'key-secret' QAPI option would >> require obtain

Re: [PATCH 1/2] block/rbd: support selected key-value-pairs via QAPI

2025-06-16 Thread Fiona Ebner
Am 16.06.25 um 12:28 schrieb Ilya Dryomov: > On Mon, Jun 16, 2025 at 11:52 AM Daniel P. Berrangé > wrote: >> On Mon, Jun 16, 2025 at 11:25:54AM +0200, Ilya Dryomov wrote: >>> On Thu, May 15, 2025 at 1:29 PM Fiona Ebner wrote: >>>> ## >>>> # @Blockd

Re: [PATCH 1/2] block/rbd: support selected key-value-pairs via QAPI

2025-06-16 Thread Fiona Ebner
Am 16.06.25 um 11:41 schrieb Daniel P. Berrangé: > On Thu, May 15, 2025 at 01:29:07PM +0200, Fiona Ebner wrote: >> @@ -4327,6 +4360,9 @@ >> # authentication. This maps to Ceph configuration option "key". >> # (Since 3.0) >> # >> +# @key-value

Re: [PATCH 0/2] block/rbd: support selected key-value-pairs via QAPI

2025-06-05 Thread Fiona Ebner
Am 15.05.25 um 13:29 schrieb Fiona Ebner: > Currently, most Ceph configuration options are not exposed via QAPI. > While it is possible to specify a dedicated Ceph configuration file, > specialized options are often only required for a selection of images > on the RBD storage, not all

[PATCH] iotests: add test for changing the 'drive' property via 'qom-set'

2025-06-05 Thread Fiona Ebner
Signed-off-by: Fiona Ebner --- tests/qemu-iotests/tests/qom-set-drive | 75 ++ tests/qemu-iotests/tests/qom-set-drive.out | 11 2 files changed, 86 insertions(+) create mode 100755 tests/qemu-iotests/tests/qom-set-drive create mode 100644 tests/qemu-iotests/tests

Re: [PATCH v4 00/48] block: do not drain while holding the graph lock

2025-06-04 Thread Fiona Ebner
Am 03.06.25 um 16:54 schrieb Kevin Wolf: > Am 30.05.2025 um 17:10 hat Fiona Ebner geschrieben: >> There were no changes for patches 01/48-09/48 and 17/48-23/48, endpoints >> inclusive. All patches starting from 25/48 are new in v4. > > This is starting to become

[PATCH 0/4] block: fix deadlock when doing blockdev-snapshot of a node with compress filter

2025-06-04 Thread Fiona Ebner
Patches 1/4 and 2/4 are tangentially related. See patches 3/4 and 4/4 for the details. I did not CC the people for the individual block drivers. Let me know if I should! Fiona Ebner (4): block/graph-lock: fix typo in comment block-coroutine-wrapper: mark generated co-wrapper as

[PATCH 4/4] iotests: add test for snapshot on top of node with compress filter

2025-06-04 Thread Fiona Ebner
Signed-off-by: Fiona Ebner --- tests/qemu-iotests/085 | 18 ++ tests/qemu-iotests/085.out | 21 + 2 files changed, 39 insertions(+) diff --git a/tests/qemu-iotests/085 b/tests/qemu-iotests/085 index 3fb7b0b5c8..5063e3e8d2 100755 --- a/tests/qemu-iotests

[PATCH 3/4] block: make calling bdrv_refresh_limits() safe while holding graph lock

2025-06-04 Thread Fiona Ebner
lback in an IO thread, but can also be reached via the QOM realize handler nvme_ns_realize(). For this caller, a bdrv_get_info_unlocked() coroutine wrapper is introduced that must be called with the graph unlocked. Signed-off-by: Fiona Ebner --- The test added by the following patch exhibits the i

[PATCH 1/4] block/graph-lock: fix typo in comment

2025-06-04 Thread Fiona Ebner
Signed-off-by: Fiona Ebner --- include/block/graph-lock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/block/graph-lock.h b/include/block/graph-lock.h index 2c26c72108..67c8d04867 100644 --- a/include/block/graph-lock.h +++ b/include/block/graph-lock.h @@ -169,7

[PATCH 2/4] block-coroutine-wrapper: mark generated co-wrapper as GRAPH_UNLOCKED

2025-06-04 Thread Fiona Ebner
Generated co-wrappers poll, so they need to be called with the graph unlocked. Signed-off-by: Fiona Ebner --- Unfortunately, it's not clear how to achieve something similar for the mixed wrappers, which would've caught the issue fixed in the following patch. scripts/block-coroutine-

Re: [PATCH v4 23/48] block: never use atomics to access bs->quiesce_counter

2025-06-02 Thread Fiona Ebner
Am 30.05.25 um 17:11 schrieb Fiona Ebner: > All accesses of bs->quiesce_counter are in the main thread, either > after a GLOBAL_STATE_CODE() macro or in a function with GRAPH_WRLOCK > annotation. Now I wonder if that is actually good enough? Because vCPUs threads can also

Re: [PATCH v4 29/48] blockdev: avoid locking and draining multiple times in external_snapshot_abort()

2025-06-02 Thread Fiona Ebner
Am 30.05.25 um 17:11 schrieb Fiona Ebner: > By using the appropriate variants bdrv_set_backing_hd_drained() and > bdrv_try_change_aio_context_locked(), there only needs to be a single > drained and write-locked section in external_snapshot_abort(). > > Signed-off-by: Fiona Ebner

[PATCH v4 41/48] block: mark bdrv_new() as GRAPH_UNLOCKED

2025-05-30 Thread Fiona Ebner
The function bdrv_new() calls bdrv_drained_begin(), which must be called with the graph unlocked. Marking bdrv_new() as GRAPH_UNLOCKED requires making the locked section in bdrv_open_inherit() shorter. Signed-off-by: Fiona Ebner --- I'm not sure if the TODO comment is only intended fo

[PATCH v4 20/48] iotests/graph-changes-while-io: remove image file after test

2025-05-30 Thread Fiona Ebner
Suggested-by: Kevin Wolf Signed-off-by: Fiona Ebner --- tests/qemu-iotests/tests/graph-changes-while-io | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qemu-iotests/tests/graph-changes-while-io b/tests/qemu-iotests/tests/graph-changes-while-io index 194fda500e..35489e3b5e 100755

[PATCH v4 42/48] block: mark bdrv_replace_child_bs() as GRAPH_UNLOCKED

2025-05-30 Thread Fiona Ebner
The function bdrv_replace_child_bs() calls bdrv_drained_begin() which must be called with the graph unlocked. Signed-off-by: Fiona Ebner --- include/block/block-global-state.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/block/block-global-state.h b/include

[PATCH v4 33/48] block/stream: mark stream_prepare() as GRAPH_UNLOCKED

2025-05-30 Thread Fiona Ebner
The function stream_prepare() calls bdrv_drain_all_begin(), which must be called with the graph unlocked. Also mark the JobDriver's prepare() callback as GRAPH_UNLOCKED_PTR, because that is the callback via which stream_prepare() is reached. Signed-off-by: Fiona Ebner --- block/str

[PATCH v4 04/48] block: move drain outside of read-locked bdrv_inactivate_recurse()

2025-05-30 Thread Fiona Ebner
This is in preparation to mark bdrv_drained_begin() as GRAPH_UNLOCKED. More granular draining is not trivially possible, because bdrv_inactivate_recurse() can recursively call itself. Signed-off-by: Fiona Ebner Reviewed-by: Kevin Wolf --- block.c | 25 ++--- 1 file changed

[PATCH v4 02/48] block: move drain outside of read-locked bdrv_reopen_queue_child()

2025-05-30 Thread Fiona Ebner
This is in preparation to mark bdrv_drained_begin() as GRAPH_UNLOCKED. More granular draining is not trivially possible, because bdrv_reopen_queue_child() can recursively call itself. Signed-off-by: Fiona Ebner Reviewed-by: Kevin Wolf --- block.c | 19 +++ 1 file changed, 11

[PATCH v4 36/48] block: mark bdrv_inactivate_all() as GRAPH_UNLOCKED

2025-05-30 Thread Fiona Ebner
The function bdrv_inactivate_all() calls bdrv_drain_all_begin(), which must be called with the graph unlocked. Signed-off-by: Fiona Ebner --- include/block/block-global-state.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/block/block-global-state.h b/include

[PATCH v4 25/48] block/mirror: switch to bdrv_set_backing_hd_drained() variant

2025-05-30 Thread Fiona Ebner
This is in preparation to mark bdrv_set_backing_hd() as GRAPH_UNLOCKED. Switch to using the bdrv_set_backing_hd_drained() variant, so that the drained and locked section can also cover the calls to bdrv_skip_filters() and bdrv_cow_bs(). Signed-off-by: Fiona Ebner --- block/mirror.c | 12

[PATCH v4 05/48] block: mark bdrv_parent_change_aio_context() GRAPH_RDLOCK

2025-05-30 Thread Fiona Ebner
This is a small step in preparation to mark bdrv_drained_begin() as GRAPH_UNLOCKED. More concretely, it allows marking the change_aio_ctx() callback GRAPH_RDLOCK_PTR, which is the next step. Signed-off-by: Fiona Ebner Reviewed-by: Kevin Wolf --- block.c | 8 1 file changed, 4

[PATCH v4 19/48] block: mark bdrv_drained_begin() and friends as GRAPH_UNLOCKED

2025-05-30 Thread Fiona Ebner
All of bdrv_drain_all_begin(), bdrv_drain_all() and bdrv_drained_begin() poll and are not allowed to be called with the block graph lock held. Mark the function as such. Suggested-by: Kevin Wolf Signed-off-by: Fiona Ebner --- include/block/block-global-state.h | 4 ++-- include/block/block

[PATCH v4 22/48] block/io: remove duplicate GLOBAL_STATE_CODE() in bdrv_do_drained_end()

2025-05-30 Thread Fiona Ebner
nnot change here, so keep only the earlier instance. Signed-off-by: Fiona Ebner --- block/io.c | 1 - 1 file changed, 1 deletion(-) diff --git a/block/io.c b/block/io.c index 4fd7768f9c..ac5c7174f6 100644 --- a/block/io.c +++ b/block/io.c @@ -413,7 +413,6 @@ static void bdrv_do_drained_end(

[PATCH v4 38/48] block: mark blk_drain() as GRAPH_UNLOCKED

2025-05-30 Thread Fiona Ebner
The function blk_drain() calls bdrv_drained_begin(), which must be called with the graph unlocked. Signed-off-by: Fiona Ebner --- include/system/block-backend-global-state.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/system/block-backend-global-state.h b

[PATCH v4 34/48] block: mark bdrv_reopen_queue() and bdrv_reopen_multiple() as GRAPH_UNLOCKED

2025-05-30 Thread Fiona Ebner
locked section in reopen_backing_file() shorter. Signed-off-by: Fiona Ebner --- block/replication.c| 3 ++- include/block/block-global-state.h | 9 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/block/replication.c b/block/replication.c index 83978b61f5

[PATCH v4 27/48] block: call bdrv_set_backing_hd() while unlocked in bdrv_open_backing_file()

2025-05-30 Thread Fiona Ebner
This is in preparation to mark bdrv_set_backing_hd() as GRAPH_UNLOCKED. Signed-off-by: Fiona Ebner --- block.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index 1da10d55f0..ca3b67b233 100644 --- a/block.c +++ b/block.c @@ -3632,7 +3632,8 @@ int

[PATCH v4 46/48] block: mark bdrv_close() as GRAPH_UNLOCKED

2025-05-30 Thread Fiona Ebner
d the bdrv_close() wrapper, which are also marked as GRAPH_UNLOCKED_PTR and GRAPH_UNLOCKED. Furthermore, the function bdrv_close() also calls bdrv_drained_begin() and bdrv_graph_wrlock_drained(), so there are additional reasons for marking it GRAPH_UNLOCKED. Signed-off-by: Fiona Ebner --- bl

[PATCH v4 21/48] iotests/graph-changes-while-io: add test case with removal of lower snapshot

2025-05-30 Thread Fiona Ebner
rename snap1->mid as suggested by Kevin Wolf remove image file after test as suggested by Kevin Wolf add type annotation for function argument to make mypy happy] Signed-off-by: Fiona Ebner --- .../qemu-iotests/tests/graph-changes-while-io | 101 -- .../tests/gr

[PATCH v4 15/48] block: move drain outside of bdrv_root_unref_child()

2025-05-30 Thread Fiona Ebner
The caller quorum_del_child() holds the graph lock, so it is not actually allowed to drain. This will be addressed in the next commit. Signed-off-by: Fiona Ebner --- Changes in v4: * Document requirement that all nodes need to be drained for bdrv_root_unref_child() and bdrv_unref_child(). *

[PATCH v4 12/48] block: move drain outside of bdrv_root_attach_child()

2025-05-30 Thread Fiona Ebner
ed section is introduced. Signed-off-by: Fiona Ebner Reviewed-by: Kevin Wolf --- Changes in v4: * Document requirement that all nodes need to be drained for bdrv_root_attach_child() and block_job_add_bdrv(). block.c | 4 ++-- block/backup.c | 2 ++ b

[PATCH v4 40/48] block/commit: mark commit_abort() as GRAPH_UNLOCKED

2025-05-30 Thread Fiona Ebner
The function commit_abort() calls bdrv_drained_begin(), which must be called with the graph unlocked. Also mark the JobDriver's abort() callback as GRAPH_UNLOCKED_PTR, because that is the callback via which commit_abort() is reached. Signed-off-by: Fiona Ebner --- block/commit.c

[PATCH v4 28/48] block: mark bdrv_set_backing_hd() as GRAPH_UNLOCKED

2025-05-30 Thread Fiona Ebner
The function bdrv_set_backing_hd() calls bdrv_drain_all_begin(), which must be called with the graph unlocked. Signed-off-by: Fiona Ebner --- include/block/block-global-state.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/block/block-global-state.h b/include

[PATCH v4 44/48] block: mark bdrv_drop_intermediate() as GRAPH_UNLOCKED

2025-05-30 Thread Fiona Ebner
The function bdrv_drop_intermediate() calls bdrv_drained_begin(), which must be called with the graph unlocked. Signed-off-by: Fiona Ebner --- include/block/block-global-state.h | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/block/block-global-state.h b

[PATCH v4 08/48] block: move drain outside of bdrv_change_aio_context() and mark GRAPH_RDLOCK

2025-05-30 Thread Fiona Ebner
e.g. via bdrv_child_change_aio_context(). [0]: https://lore.kernel.org/qemu-devel/73839c04-7616-407e-b057-80ca69e63...@virtuozzo.com/ Reported-by: Andrey Drobyshev Signed-off-by: Fiona Ebner Reviewed-by: Kevin Wolf --- block.c | 57 +++- include/block/block_int-

[PATCH v4 37/48] block: mark blk_remove_bs() as GRAPH_UNLOCKED

2025-05-30 Thread Fiona Ebner
The function blk_remove_bs() calls bdrv_graph_wrlock_drained() and can also call bdrv_drained_begin(), both of which which must be called with the graph unlocked. Marking blk_remove_bs() as GRAPH_UNLOCKED requires temporarily unlocking in hmp_drive_del(). Signed-off-by: Fiona Ebner --- block

[PATCH v4 39/48] block-backend: mark blk_io_limits_disable() as GRAPH_UNLOCKED

2025-05-30 Thread Fiona Ebner
The function blk_io_limits_disable() calls bdrv_drained_begin(), which must be called with the graph unlocked. Signed-off-by: Fiona Ebner --- include/system/block-backend-global-state.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/system/block-backend-global

[PATCH v4 29/48] blockdev: avoid locking and draining multiple times in external_snapshot_abort()

2025-05-30 Thread Fiona Ebner
By using the appropriate variants bdrv_set_backing_hd_drained() and bdrv_try_change_aio_context_locked(), there only needs to be a single drained and write-locked section in external_snapshot_abort(). Signed-off-by: Fiona Ebner --- The assumption in the added code comment about the reference is

[PATCH v4 17/48] blockdev: drain while unlocked in internal_snapshot_action()

2025-05-30 Thread Fiona Ebner
This is in preparation to mark bdrv_drained_begin() as GRAPH_UNLOCKED. Signed-off-by: Fiona Ebner --- blockdev.c | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/blockdev.c b/blockdev.c index bd5ca77619..506755bef1 100644 --- a/blockdev.c +++ b/blockdev.c

[PATCH v4 07/48] block: mark bdrv_child_change_aio_context() GRAPH_RDLOCK

2025-05-30 Thread Fiona Ebner
This is a small step in preparation to mark bdrv_drained_begin() as GRAPH_UNLOCKED. More concretely, it is in preparation to move the drain out of bdrv_change_aio_context() and marking that function as GRAPH_RDLOCK. Signed-off-by: Fiona Ebner Reviewed-by: Kevin Wolf --- include/block/block

[PATCH v4 14/48] block: move drain outside of quorum_add_child()

2025-05-30 Thread Fiona Ebner
ch is only called in the bdrv_add_child() function, which also runs under the graph lock. The bdrv_add_child() function is called by qmp_x_blockdev_change(), where a drained section is introduced. Signed-off-by: Fiona Ebner --- Changes in v4: * Document requirement that all nodes need to be d

[PATCH v4 13/48] block: move drain outside of bdrv_attach_child()

2025-05-30 Thread Fiona Ebner
t. Signed-off-by: Fiona Ebner Reviewed-by: Kevin Wolf --- Changes in v4: * Document requirement that all nodes need to be drained for bdrv_attach_child(). block.c | 6 -- block/quorum.c | 2 ++ block/replication.c | 5 + tests

[PATCH v4 11/48] block: move drain outside of bdrv_set_backing_hd_drained()

2025-05-30 Thread Fiona Ebner
ned-off-by: Fiona Ebner --- Changes in v4: * Drop now superfluous drain_bs variable. * Document requirement that all nodes need to be drained for bdrv_set_backing_hd_drained(). block.c| 16 +++- block/stream.c | 6 ++ 2 files changed, 5 insertions(+), 17 deletions(-) di

[PATCH v4 48/48] blockjob: mark block_job_remove_all_bdrv() as GRAPH_UNLOCKED

2025-05-30 Thread Fiona Ebner
The function block_job_remove_all_bdrv() calls bdrv_graph_wrlock_drained(), which must be called with the graph unlocked. Signed-off-by: Fiona Ebner --- include/block/blockjob.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/block/blockjob.h b/include/block

[PATCH v4 35/48] block: mark bdrv_inactivate() as GRAPH_RDLOCK and move drain to callers

2025-05-30 Thread Fiona Ebner
covers bdrv_find_node() too, so the latter alternative is chosen. Signed-off-by: Fiona Ebner --- block.c| 14 ++ blockdev.c | 75 ++ include/block/block-global-state.h | 2 +- 3 files changed, 51 insertions(+), 40

[PATCH v4 24/48] block: add bdrv_graph_wrlock_drained() convenience wrapper

2025-05-30 Thread Fiona Ebner
rv_graph_wrlock();/bdrv_graph_wrlock_drained();/g' {} ';' find . -name '*.c' -exec sed -i -z 's/bdrv_graph_wrunlock();\n\s*bdrv_drain_all_end();/bdrv_graph_wrunlock();/g' {} ';' Suggested-by: Kevin Wolf Signed-off-by: Fiona Ebner --- Changes in v4: * Adapt

[PATCH v4 47/48] block: mark bdrv_open_child_common() and its callers GRAPH_UNLOCKED

2025-05-30 Thread Fiona Ebner
section shorter in vmdk_open(). Signed-off-by: Fiona Ebner --- block.c| 13 ++--- block/vmdk.c | 6 -- include/block/block-global-state.h | 9 + 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/block.c b/block.c

[PATCH v4 32/48] block/snapshot: mark bdrv_all_delete_snapshot() as GRAPH_UNLOCKED

2025-05-30 Thread Fiona Ebner
The function bdrv_all_delete_snapshot() calls bdrv_drain_all_begin(), which must be called with the graph unlocked. Signed-off-by: Fiona Ebner --- include/block/snapshot.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/block/snapshot.h b/include/block

[PATCH v4 06/48] block: mark change_aio_ctx() callback and instances as GRAPH_RDLOCK(_PTR)

2025-05-30 Thread Fiona Ebner
This is a small step in preparation to mark bdrv_drained_begin() as GRAPH_UNLOCKED. More concretely, it is in preparation to move the drain out of bdrv_change_aio_context() and marking that function as GRAPH_RDLOCK. Signed-off-by: Fiona Ebner Reviewed-by: Kevin Wolf --- block.c

[PATCH v4 23/48] block: never use atomics to access bs->quiesce_counter

2025-05-30 Thread Fiona Ebner
E() macro nor the GRAPH_WRLOCK annotation existed. Even if the field was only accessed in the main thread back then (did not check if that is actually the case), it wouldn't have been easy to verify. Signed-off-by: Fiona Ebner --- block/io.c | 7 ++- include/block/

[PATCH v4 26/48] block/commit: switch to bdrv_set_backing_hd_drained() variant

2025-05-30 Thread Fiona Ebner
also cover bdrv_cow_bs(). Signed-off-by: Fiona Ebner --- block/commit.c | 32 +--- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/block/commit.c b/block/commit.c index dc1942483b..c9690a5da0 100644 --- a/block/commit.c +++ b/block/commit.c @@ -514,28

[PATCH v4 01/48] block: remove outdated comments about AioContext locking

2025-05-30 Thread Fiona Ebner
AioContext locking was removed in commit b49f4755c7 ("block: remove AioContext locking"). Signed-off-by: Fiona Ebner Reviewed-by: Kevin Wolf --- block.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/block.c b/block.c index f222e1a50a..a5399888ba 100644 --- a/block.c +++

[PATCH v4 45/48] block: mark bdrv_close_all() as GRAPH_UNLOCKED

2025-05-30 Thread Fiona Ebner
The function bdrv_close_all() calls bdrv_drain_all(), which must be called with the graph unlocked. Signed-off-by: Fiona Ebner --- include/block/block-global-state.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/block/block-global-state.h b/include/block/block

[PATCH v4 09/48] block: move drain outside of bdrv_try_change_aio_context()

2025-05-30 Thread Fiona Ebner
tions like qmp_blockdev_mirror() query the nodes to act on before draining and locking. In theory, draining could invalidate those nodes. This kind of issue is not addressed by these commits. Signed-off-by: Fiona Ebner Reviewed-by: Kevin Wolf --- block.c

[PATCH v4 16/48] block: move drain outside of quorum_del_child()

2025-05-30 Thread Fiona Ebner
K". Signed-off-by: Fiona Ebner --- Changes in v4: * Document requirement that all nodes need to be drained for bdrv_del_child() wrapper and callback. * Add function comment for bdrv_del_child() callback. block.c | 2 ++ block/quorum.c |

[PATCH v4 43/48] block: mark bdrv_insert_node() as GRAPH_UNLOCKED

2025-05-30 Thread Fiona Ebner
The function bdrv_insert_node() calls bdrv_drained_begin() which must be called with the graph unlocked. Signed-off-by: Fiona Ebner --- include/block/block-global-state.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/block/block-global-state.h b/include/block

[PATCH v4 18/48] blockdev: drain while unlocked in external_snapshot_action()

2025-05-30 Thread Fiona Ebner
This is in preparation to mark bdrv_drained_begin() as GRAPH_UNLOCKED. Signed-off-by: Fiona Ebner --- blockdev.c | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/blockdev.c b/blockdev.c index 506755bef1..2e7fda6780 100644 --- a/blockdev.c +++ b/blockdev.c

[PATCH v4 10/48] block: move drain outside of bdrv_attach_child_common(_abort)()

2025-05-30 Thread Fiona Ebner
e(). This resolves all code paths. The functions bdrv_set_backing_hd_drained(), bdrv_attach_child() and bdrv_root_attach_child() run under the graph lock, so they are not actually allowed to drain. This will be addressed in the following commits. Signed-off-by: Fiona Ebner --- Changes in v

[PATCH v4 00/48] block: do not drain while holding the graph lock

2025-05-30 Thread Fiona Ebner
44485-1-f.eb...@proxmox.com/ [3]: https://lore.kernel.org/qemu-devel/73839c04-7616-407e-b057-80ca69e63...@virtuozzo.com/ [4]: https://lore.kernel.org/qemu-devel/20250529203147.180338-1-stefa...@redhat.com/ Andrey Drobyshev (1): iotests/graph-changes-while-io: add test case with removal of lower

[PATCH v4 31/48] block-backend: mark blk_drain_all() as GRAPH_UNLOCKED

2025-05-30 Thread Fiona Ebner
The function blk_drain_all() calls bdrv_drain_all_begin(), which must be called with the graph unlocked. Signed-off-by: Fiona Ebner --- include/system/block-backend-global-state.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/system/block-backend-global-state.h b

[PATCH v4 03/48] block/snapshot: move drain outside of read-locked bdrv_snapshot_delete()

2025-05-30 Thread Fiona Ebner
fine for the existing callers of bdrv_all_delete_snapshot(). Signed-off-by: Fiona Ebner Reviewed-by: Kevin Wolf --- block/snapshot.c | 26 +++--- blockdev.c | 25 + qemu-img.c | 2 ++ 3 files changed, 34 insertions(+), 19 deletions

[PATCH v4 30/48] block: drop wrapper for bdrv_set_backing_hd_drained()

2025-05-30 Thread Fiona Ebner
Nearly all callers (outside of the tests) are already using the _drained() variant of the function. It doesn't seem worth keeping. Simply adapt the remaining callers of bdrv_set_backing_hd() and rename bdrv_set_backing_hd_drained() to bdrv_set_backing_hd(). Signed-off-by: Fiona

Re: [PATCH v3 11/24] block: move drain outside of bdrv_set_backing_hd_drained()

2025-05-28 Thread Fiona Ebner
Am 27.05.25 um 17:29 schrieb Kevin Wolf: > Am 26.05.2025 um 15:21 hat Fiona Ebner geschrieben: >> @@ -3578,7 +3577,6 @@ int bdrv_set_backing_hd_drained(BlockDriverState *bs, >> ret = bdrv_refresh_perms(bs, tran, errp); >> out: >> tran_finalize(tran, ret);

Re: [PATCH v3 10/24] block: move drain outside of bdrv_attach_child_common(_abort)()

2025-05-28 Thread Fiona Ebner
Am 27.05.25 um 17:23 schrieb Kevin Wolf: > Am 26.05.2025 um 15:21 hat Fiona Ebner geschrieben: >> @@ -3129,11 +3123,9 @@ bdrv_attach_child_common(BlockDriverState *child_bs, >> bool ret_child; >> >> g_hash_t

[PATCH v3 22/24] block/io: remove duplicate GLOBAL_STATE_CODE() in bdrv_do_drained_end()

2025-05-26 Thread Fiona Ebner
nnot change here, so keep only the earlier instance. Signed-off-by: Fiona Ebner --- No changes in v3. block/io.c | 1 - 1 file changed, 1 deletion(-) diff --git a/block/io.c b/block/io.c index 4fd7768f9c..ac5c7174f6 100644 --- a/block/io.c +++ b/block/io.c @@ -413,7 +413,6 @@ static void

[PATCH v3 24/24] block: add bdrv_graph_wrlock_drained() convenience wrapper

2025-05-26 Thread Fiona Ebner
bdrv_graph_wrunlock();\n\s*bdrv_drain_all_end();/bdrv_graph_wrunlock();/g' {} ';' Suggested-by: Kevin Wolf Signed-off-by: Fiona Ebner --- Changes in v3: * Fix typo in commit message. block.c | 20 block/backup.c | 4 +--- bloc

[PATCH v3 20/24] iotests/graph-changes-while-io: remove image file after test

2025-05-26 Thread Fiona Ebner
Suggested-by: Kevin Wolf Signed-off-by: Fiona Ebner --- No changes in v3. tests/qemu-iotests/tests/graph-changes-while-io | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qemu-iotests/tests/graph-changes-while-io b/tests/qemu-iotests/tests/graph-changes-while-io index 194fda500e

[PATCH v3 15/24] block: move drain outside of bdrv_root_unref_child()

2025-05-26 Thread Fiona Ebner
it is not actually allowed to drain. This will be addressed in the next commit. Signed-off-by: Fiona Ebner --- No changes in v3. block.c | 6 -- block/blklogwrites.c | 4 block/blkverify.c| 2 ++ block/block-backend.c| 2 ++ blo

[PATCH v3 03/24] block/snapshot: move drain outside of read-locked bdrv_snapshot_delete()

2025-05-26 Thread Fiona Ebner
fine for the existing callers of bdrv_all_delete_snapshot(). Signed-off-by: Fiona Ebner Reviewed-by: Kevin Wolf --- No changes in v3. block/snapshot.c | 26 +++--- blockdev.c | 25 + qemu-img.c | 2 ++ 3 files changed, 34 insertions

[PATCH v3 02/24] block: move drain outside of read-locked bdrv_reopen_queue_child()

2025-05-26 Thread Fiona Ebner
This is in preparation to mark bdrv_drained_begin() as GRAPH_UNLOCKED. More granular draining is not trivially possible, because bdrv_reopen_queue_child() can recursively call itself. Signed-off-by: Fiona Ebner Reviewed-by: Kevin Wolf --- No changes in v3. block.c | 19

[PATCH v3 17/24] blockdev: drain while unlocked in internal_snapshot_action()

2025-05-26 Thread Fiona Ebner
This is in preparation to mark bdrv_drained_begin() as GRAPH_UNLOCKED. Signed-off-by: Fiona Ebner --- No changes in v3. blockdev.c | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/blockdev.c b/blockdev.c index bd5ca77619..506755bef1 100644 --- a

[PATCH v3 05/24] block: mark bdrv_parent_change_aio_context() GRAPH_RDLOCK

2025-05-26 Thread Fiona Ebner
This is a small step in preparation to mark bdrv_drained_begin() as GRAPH_UNLOCKED. More concretely, it allows marking the change_aio_ctx() callback GRAPH_RDLOCK_PTR, which is the next step. Signed-off-by: Fiona Ebner Reviewed-by: Kevin Wolf --- No changes in v3. block.c | 8 1 file

[PATCH v3 09/24] block: move drain outside of bdrv_try_change_aio_context()

2025-05-26 Thread Fiona Ebner
tions like qmp_blockdev_mirror() query the nodes to act on before draining and locking. In theory, draining could invalidate those nodes. This kind of issue is not addressed by these commits. Signed-off-by: Fiona Ebner --- Changes in v3: * Clarify that _locked() version was used iff caller already

[PATCH v3 12/24] block: move drain outside of bdrv_root_attach_child()

2025-05-26 Thread Fiona Ebner
ed section is introduced. Signed-off-by: Fiona Ebner --- No changes in v3. block.c | 2 -- block/backup.c | 2 ++ block/block-backend.c| 2 ++ block/commit.c | 4 block/mirror.c | 5 + block/stream.c

[PATCH v3 21/24] iotests/graph-changes-while-io: add test case with removal of lower snapshot

2025-05-26 Thread Fiona Ebner
rename snap1->mid as suggested by Kevin Wolf remove image file after test as suggested by Kevin Wolf add type annotation for function argument to make mypy happy] Signed-off-by: Fiona Ebner --- No changes in v3. .../qemu-iotests/tests/graph-changes-while-io |

[PATCH v3 06/24] block: mark change_aio_ctx() callback and instances as GRAPH_RDLOCK(_PTR)

2025-05-26 Thread Fiona Ebner
This is a small step in preparation to mark bdrv_drained_begin() as GRAPH_UNLOCKED. More concretely, it is in preparation to move the drain out of bdrv_change_aio_context() and marking that function as GRAPH_RDLOCK. Signed-off-by: Fiona Ebner Reviewed-by: Kevin Wolf --- Changes in v3: * Fix

[PATCH v3 10/24] block: move drain outside of bdrv_attach_child_common(_abort)()

2025-05-26 Thread Fiona Ebner
e(). This resolves all code paths. The functions bdrv_set_backing_hd_drained(), bdrv_attach_child() and bdrv_root_attach_child() run under the graph lock, so they are not actually allowed to drain. This will be addressed in the following commits. Signed-off-by: Fiona Ebner --- No changes in v3.

[PATCH v3 23/24] block: never use atomics to access bs->quiesce_counter

2025-05-26 Thread Fiona Ebner
E() macro nor the GRAPH_WRLOCK annotation existed. Even if the field was only accessed in the main thread back then (did not check if that is actually the case), it wouldn't have been easy to verify. Signed-off-by: Fiona Ebner --- No changes in v3. block/io.c | 7 ++--

[PATCH v3 08/24] block: move drain outside of bdrv_change_aio_context() and mark GRAPH_RDLOCK

2025-05-26 Thread Fiona Ebner
e.g. via bdrv_child_change_aio_context(). [0]: https://lore.kernel.org/qemu-devel/73839c04-7616-407e-b057-80ca69e63...@virtuozzo.com/ Reported-by: Andrey Drobyshev Signed-off-by: Fiona Ebner --- Changes in v3: * Extend drained section in bdrv_try_change_aio_context() until after the transaction is finalized. * A

[PATCH v3 01/24] block: remove outdated comments about AioContext locking

2025-05-26 Thread Fiona Ebner
AioContext locking was removed in commit b49f4755c7 ("block: remove AioContext locking"). Signed-off-by: Fiona Ebner Reviewed-by: Kevin Wolf --- No changes in v3. block.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/block.c b/block.c index f222e1a50a..a5399888ba 10

[PATCH v3 07/24] block: mark bdrv_child_change_aio_context() GRAPH_RDLOCK

2025-05-26 Thread Fiona Ebner
This is a small step in preparation to mark bdrv_drained_begin() as GRAPH_UNLOCKED. More concretely, it is in preparation to move the drain out of bdrv_change_aio_context() and marking that function as GRAPH_RDLOCK. Signed-off-by: Fiona Ebner Reviewed-by: Kevin Wolf --- Changes in v3: * Fix

[PATCH v3 13/24] block: move drain outside of bdrv_attach_child()

2025-05-26 Thread Fiona Ebner
t. Signed-off-by: Fiona Ebner --- No changes in v3. block.c | 4 ++-- block/quorum.c | 2 ++ block/replication.c | 5 + tests/unit/test-bdrv-drain.c | 14 ++ tests/unit/test-bdrv-graph-mod.c | 10 ++ 5 files c

[PATCH v3 19/24] block: mark bdrv_drained_begin() and friends as GRAPH_UNLOCKED

2025-05-26 Thread Fiona Ebner
All of bdrv_drain_all_begin(), bdrv_drain_all() and bdrv_drained_begin() poll and are not allowed to be called with the block graph lock held. Mark the function as such. Suggested-by: Kevin Wolf Signed-off-by: Fiona Ebner --- Changes in v3: * Also mark bdrv_drain_all_begin() and bdrv_drain_all

[PATCH v3 11/24] block: move drain outside of bdrv_set_backing_hd_drained()

2025-05-26 Thread Fiona Ebner
a drained section is introduced, replacing the previously present bs-specific drains. 2. stream_prepare(), where a drained section is introduced replacing the previously present bs-specific drains. Signed-off-by: Fiona Ebner --- No changes in v3. block.c| 6 ++ block/stream.c | 6

[PATCH v3 14/24] block: move drain outside of quorum_add_child()

2025-05-26 Thread Fiona Ebner
ch is only called in the bdrv_add_child() function, which also runs under the graph lock. The bdrv_add_child() function is called by qmp_x_blockdev_change(), where a drained section is introduced. Signed-off-by: Fiona Ebner --- No changes in v3. block/quorum.c | 2 -- blockdev.c | 2 ++ 2 fil

[PATCH v3 04/24] block: move drain outside of read-locked bdrv_inactivate_recurse()

2025-05-26 Thread Fiona Ebner
This is in preparation to mark bdrv_drained_begin() as GRAPH_UNLOCKED. More granular draining is not trivially possible, because bdrv_inactivate_recurse() can recursively call itself. Signed-off-by: Fiona Ebner Reviewed-by: Kevin Wolf --- No changes in v3. block.c | 25

  1   2   3   4   5   >