From: Max Reitz Date: Wed, 12 Jun 2019 16:55:04 +0000 (+0200) Subject: nbd: Use CAF when looking for dirty bitmap X-Git-Tag: v5.2.0-rc0~123^2~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ee2f94ca2799f3a6536cf19235c9bb44be919956;p=thirdparty%2Fqemu.git nbd: Use CAF when looking for dirty bitmap When looking for a dirty bitmap to share, we should handle filters by just including them in the search (so they do not break backing chains). Signed-off-by: Max Reitz Reviewed-by: Andrey Shinkevich Reviewed-by: Kevin Wolf --- diff --git a/nbd/server.c b/nbd/server.c index c5d71cff100..982de67816a 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -1567,13 +1567,13 @@ NBDExport *nbd_export_new(BlockDriverState *bs, uint64_t dev_offset, if (bitmap) { BdrvDirtyBitmap *bm = NULL; - while (true) { + while (bs) { bm = bdrv_find_dirty_bitmap(bs, bitmap); - if (bm != NULL || bs->backing == NULL) { + if (bm != NULL) { break; } - bs = bs->backing->bs; + bs = bdrv_filter_or_cow_bs(bs); } if (bm == NULL) {