Blame SOURCES/kvm-nbd-client-Make-x-dirty-bitmap-more-reliable.patch

7711c0
From 4a378f730e73452bf9bf3a5c761f7d0efdae9d27 Mon Sep 17 00:00:00 2001
7711c0
From: John Snow <jsnow@redhat.com>
7711c0
Date: Fri, 22 Mar 2019 03:22:39 +0100
7711c0
Subject: [PATCH 072/163] nbd/client: Make x-dirty-bitmap more reliable
7711c0
7711c0
RH-Author: John Snow <jsnow@redhat.com>
7711c0
Message-id: <20190322032241.8111-27-jsnow@redhat.com>
7711c0
Patchwork-id: 85106
7711c0
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 26/28] nbd/client: Make x-dirty-bitmap more reliable
7711c0
Bugzilla: 1691563
7711c0
RH-Acked-by: Max Reitz <mreitz@redhat.com>
7711c0
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
7711c0
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
7711c0
From: Eric Blake <eblake@redhat.com>
7711c0
7711c0
The implementation of x-dirty-bitmap in qemu 3.0 (commit 216ee365)
7711c0
silently falls back to treating the server as not supporting
7711c0
NBD_CMD_BLOCK_STATUS if a requested meta_context name was not
7711c0
negotiated, which in turn means treating the _entire_ image as
7711c0
data. Since our hack relied on using 'qemu-img map' to view
7711c0
which portions of the image were dirty by seeing what the
7711c0
redirected bdrv_block_status() treats as holes, this means
7711c0
that our fallback treats the entire image as clean.  Better
7711c0
would have been to treat the entire image as dirty, or to fail
7711c0
to connect because the user's request for a specific context
7711c0
could not be honored. This patch goes with the latter.
7711c0
7711c0
Signed-off-by: Eric Blake <eblake@redhat.com>
7711c0
Message-Id: <20181130023232.3079982-3-eblake@redhat.com>
7711c0
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
7711c0
(cherry picked from commit 47829c40794160debdb33b4a042d182e776876d4)
7711c0
Signed-off-by: John Snow <jsnow@redhat.com>
7711c0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
---
7711c0
 block/nbd-client.c | 5 +++++
7711c0
 1 file changed, 5 insertions(+)
7711c0
7711c0
diff --git a/block/nbd-client.c b/block/nbd-client.c
7711c0
index 76e9ca3..e6e27da 100644
7711c0
--- a/block/nbd-client.c
7711c0
+++ b/block/nbd-client.c
7711c0
@@ -992,6 +992,11 @@ int nbd_client_init(BlockDriverState *bs,
7711c0
         logout("Failed to negotiate with the NBD server\n");
7711c0
         return ret;
7711c0
     }
7711c0
+    if (x_dirty_bitmap && !client->info.base_allocation) {
7711c0
+        error_setg(errp, "requested x-dirty-bitmap %s not found",
7711c0
+                   x_dirty_bitmap);
7711c0
+        return -EINVAL;
7711c0
+    }
7711c0
     if (client->info.flags & NBD_FLAG_READ_ONLY) {
7711c0
         ret = bdrv_apply_auto_read_only(bs, "NBD export is read-only", errp);
7711c0
         if (ret < 0) {
7711c0
-- 
7711c0
1.8.3.1
7711c0