Blame SOURCES/kvm-nbd-change-error-checking-order-for-bitmaps.patch

383d26
From 4118dc26c6ad7a69c11522d25ead648ffdf0088e Mon Sep 17 00:00:00 2001
383d26
From: John Snow <jsnow@redhat.com>
383d26
Date: Wed, 3 Apr 2019 18:18:43 +0200
383d26
Subject: [PATCH 138/163] nbd: change error checking order for bitmaps
383d26
383d26
RH-Author: John Snow <jsnow@redhat.com>
383d26
Message-id: <20190403181857.9693-8-jsnow@redhat.com>
383d26
Patchwork-id: 85414
383d26
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 07/21] nbd: change error checking order for bitmaps
383d26
Bugzilla: 1677073
383d26
RH-Acked-by: Max Reitz <mreitz@redhat.com>
383d26
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
383d26
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
383d26
383d26
Check that the bitmap is not in use prior to it checking if it is
383d26
not enabled/recording guest writes. The bitmap being busy was likely
383d26
at the behest of the user, so this error has a greater chance of being
383d26
understood by the user.
383d26
383d26
Signed-off-by: John Snow <jsnow@redhat.com>
383d26
Reviewed-by: Eric Blake <eblake@redhat.com>
383d26
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
383d26
Message-id: 20190223000614.13894-6-jsnow@redhat.com
383d26
Signed-off-by: John Snow <jsnow@redhat.com>
383d26
(cherry picked from commit 3b78a92776bf1199b6864f2f38d9d341fb741f36)
383d26
Signed-off-by: John Snow <jsnow@redhat.com>
383d26
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
383d26
---
383d26
 nbd/server.c | 10 +++++-----
383d26
 1 file changed, 5 insertions(+), 5 deletions(-)
383d26
383d26
diff --git a/nbd/server.c b/nbd/server.c
383d26
index 0910d09..de21c64 100644
383d26
--- a/nbd/server.c
383d26
+++ b/nbd/server.c
383d26
@@ -1510,6 +1510,11 @@ NBDExport *nbd_export_new(BlockDriverState *bs, uint64_t dev_offset,
383d26
             goto fail;
383d26
         }
383d26
 
383d26
+        if (bdrv_dirty_bitmap_user_locked(bm)) {
383d26
+            error_setg(errp, "Bitmap '%s' is in use", bitmap);
383d26
+            goto fail;
383d26
+        }
383d26
+
383d26
         if ((nbdflags & NBD_FLAG_READ_ONLY) && bdrv_is_writable(bs) &&
383d26
             bdrv_dirty_bitmap_enabled(bm)) {
383d26
             error_setg(errp,
383d26
@@ -1518,11 +1523,6 @@ NBDExport *nbd_export_new(BlockDriverState *bs, uint64_t dev_offset,
383d26
             goto fail;
383d26
         }
383d26
 
383d26
-        if (bdrv_dirty_bitmap_user_locked(bm)) {
383d26
-            error_setg(errp, "Bitmap '%s' is in use", bitmap);
383d26
-            goto fail;
383d26
-        }
383d26
-
383d26
         bdrv_dirty_bitmap_set_qmp_locked(bm, true);
383d26
         exp->export_bitmap = bm;
383d26
         exp->export_bitmap_context = g_strdup_printf("qemu:dirty-bitmap:%s",
383d26
-- 
383d26
1.8.3.1
383d26