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

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