stream: Traverse graph after modification
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>
This commit is contained in:
parent
42f6c9179b
commit
8d3dd037d9
|
@ -54,8 +54,8 @@ static int stream_prepare(Job *job)
|
||||||
{
|
{
|
||||||
StreamBlockJob *s = container_of(job, StreamBlockJob, common.job);
|
StreamBlockJob *s = container_of(job, StreamBlockJob, common.job);
|
||||||
BlockDriverState *unfiltered_bs = bdrv_skip_filters(s->target_bs);
|
BlockDriverState *unfiltered_bs = bdrv_skip_filters(s->target_bs);
|
||||||
BlockDriverState *base = bdrv_filter_or_cow_bs(s->above_base);
|
BlockDriverState *base;
|
||||||
BlockDriverState *unfiltered_base = bdrv_skip_filters(base);
|
BlockDriverState *unfiltered_base;
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
@ -63,6 +63,9 @@ static int stream_prepare(Job *job)
|
||||||
bdrv_cor_filter_drop(s->cor_filter_bs);
|
bdrv_cor_filter_drop(s->cor_filter_bs);
|
||||||
s->cor_filter_bs = NULL;
|
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)) {
|
if (bdrv_cow_child(unfiltered_bs)) {
|
||||||
const char *base_id = NULL, *base_fmt = NULL;
|
const char *base_id = NULL, *base_fmt = NULL;
|
||||||
if (unfiltered_base) {
|
if (unfiltered_base) {
|
||||||
|
|
Loading…
Reference in New Issue