OSDN Git Service

nbd: Use CAF when looking for dirty bitmap
authorMax Reitz <mreitz@redhat.com>
Wed, 12 Jun 2019 16:55:04 +0000 (18:55 +0200)
committerKevin Wolf <kwolf@redhat.com>
Mon, 7 Sep 2020 10:31:31 +0000 (12:31 +0200)
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 <mreitz@redhat.com>
Reviewed-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
nbd/server.c

index c5d71cf..982de67 100644 (file)
@@ -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) {