diff options
author | Vladimir Sementsov-Ogievskiy | 2021-04-28 17:17:32 +0200 |
---|---|---|
committer | Kevin Wolf | 2021-04-30 12:27:47 +0200 |
commit | ae9d441706d7b7d624a342b464136804b3b7bc3a (patch) | |
tree | 77826e48fadf6d93e679b04e533970a96694627c /block | |
parent | tests/test-bdrv-graph-mod: add test_append_greedy_filter (diff) | |
download | qemu-ae9d441706d7b7d624a342b464136804b3b7bc3a.tar.gz qemu-ae9d441706d7b7d624a342b464136804b3b7bc3a.tar.xz qemu-ae9d441706d7b7d624a342b464136804b3b7bc3a.zip |
block: bdrv_append(): don't consume reference
We have too much comments for this feature. It seems better just don't
do it. Most of real users (tests don't count) have to create additional
reference.
Drop also comment in external_snapshot_prepare:
- bdrv_append doesn't "remove" old bs in common sense, it sounds
strange
- the fact that bdrv_append can fail is obvious from the context
- the fact that we must rollback all changes in transaction abort is
known (it's the direct role of abort)
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20210428151804.439460-5-vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/backup-top.c | 1 | ||||
-rw-r--r-- | block/commit.c | 1 | ||||
-rw-r--r-- | block/mirror.c | 3 |
3 files changed, 1 insertions, 4 deletions
diff --git a/block/backup-top.c b/block/backup-top.c index 589e8b651d..62d09f213e 100644 --- a/block/backup-top.c +++ b/block/backup-top.c @@ -234,7 +234,6 @@ BlockDriverState *bdrv_backup_top_append(BlockDriverState *source, bdrv_drained_begin(source); - bdrv_ref(top); ret = bdrv_append(top, source, errp); if (ret < 0) { error_prepend(errp, "Cannot append backup-top filter: "); diff --git a/block/commit.c b/block/commit.c index dd9ba87349..b89bb20b75 100644 --- a/block/commit.c +++ b/block/commit.c @@ -312,6 +312,7 @@ void commit_start(const char *job_id, BlockDriverState *bs, commit_top_bs->total_sectors = top->total_sectors; ret = bdrv_append(commit_top_bs, top, errp); + bdrv_unref(commit_top_bs); /* referenced by new parents or failed */ if (ret < 0) { commit_top_bs = NULL; goto fail; diff --git a/block/mirror.c b/block/mirror.c index 5a71bd8bbc..840b8e8c15 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1630,9 +1630,6 @@ static BlockJob *mirror_start_job( bs_opaque->is_commit = target_is_backing; - /* bdrv_append takes ownership of the mirror_top_bs reference, need to keep - * it alive until block_job_create() succeeds even if bs has no parent. */ - bdrv_ref(mirror_top_bs); bdrv_drained_begin(bs); ret = bdrv_append(mirror_top_bs, bs, errp); bdrv_drained_end(bs); |