[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 01/13] stream: Traverse graph after modification
From: |
Hanna Reitz |
Subject: |
[PULL v2 01/13] stream: Traverse graph after modification |
Date: |
Tue, 16 Nov 2021 14:06:06 +0100 |
bdrv_cor_filter_drop() modifies the block graph. That means that other
parties can also modify the block graph before it returns. Therefore,
we cannot assume that the result of a graph traversal we did before
remains valid afterwards.
We should thus fetch `base` and `unfiltered_base` afterwards instead of
before.
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20211111120829.81329-2-hreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20211115145409.176785-2-kwolf@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
---
block/stream.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/block/stream.c b/block/stream.c
index 97bee482dc..e45113aed6 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -54,8 +54,8 @@ static int stream_prepare(Job *job)
{
StreamBlockJob *s = container_of(job, StreamBlockJob, common.job);
BlockDriverState *unfiltered_bs = bdrv_skip_filters(s->target_bs);
- BlockDriverState *base = bdrv_filter_or_cow_bs(s->above_base);
- BlockDriverState *unfiltered_base = bdrv_skip_filters(base);
+ BlockDriverState *base;
+ BlockDriverState *unfiltered_base;
Error *local_err = NULL;
int ret = 0;
@@ -63,6 +63,9 @@ static int stream_prepare(Job *job)
bdrv_cor_filter_drop(s->cor_filter_bs);
s->cor_filter_bs = NULL;
+ base = bdrv_filter_or_cow_bs(s->above_base);
+ unfiltered_base = bdrv_skip_filters(base);
+
if (bdrv_cow_child(unfiltered_bs)) {
const char *base_id = NULL, *base_fmt = NULL;
if (unfiltered_base) {
--
2.33.1
- [PULL v2 04/13] block: Drop detached child from ignore list, (continued)
- [PULL v2 04/13] block: Drop detached child from ignore list, Hanna Reitz, 2021/11/16
- [PULL v2 06/13] block: Restructure remove_file_or_backing_child(), Hanna Reitz, 2021/11/16
- [PULL v2 05/13] block: Pass BdrvChild ** to replace_child_noperm, Hanna Reitz, 2021/11/16
- [PULL v2 07/13] transactions: Invoke clean() after everything else, Hanna Reitz, 2021/11/16
- [PULL v2 08/13] block: Let replace_child_tran keep indirect pointer, Hanna Reitz, 2021/11/16
- [PULL v2 10/13] iotests/030: Unthrottle parallel jobs in reverse, Hanna Reitz, 2021/11/16
- [PULL v2 11/13] docs: Deprecate incorrectly typed device_add arguments, Hanna Reitz, 2021/11/16
- [PULL v2 09/13] block: Let replace_child_noperm free children, Hanna Reitz, 2021/11/16
- [PULL v2 12/13] softmmu/qdev-monitor: fix use-after-free in qdev_set_id(), Hanna Reitz, 2021/11/16
- [PULL v2 13/13] file-posix: Fix alignment after reopen changing O_DIRECT, Hanna Reitz, 2021/11/16
- [PULL v2 01/13] stream: Traverse graph after modification,
Hanna Reitz <=
- Re: [PULL v2 00/13] Block patches, Richard Henderson, 2021/11/16