26ba25
From 62c3dde0dcd04ce52e761beb66a3ec4aacd007e6 Mon Sep 17 00:00:00 2001
26ba25
From: John Snow <jsnow@redhat.com>
26ba25
Date: Wed, 18 Jul 2018 22:55:08 +0200
26ba25
Subject: [PATCH 250/268] nbd/server: Fix dirty bitmap logic regression
26ba25
26ba25
RH-Author: John Snow <jsnow@redhat.com>
26ba25
Message-id: <20180718225511.14878-33-jsnow@redhat.com>
26ba25
Patchwork-id: 81427
26ba25
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 32/35] nbd/server: Fix dirty bitmap logic regression
26ba25
Bugzilla: 1207657
26ba25
RH-Acked-by: Eric Blake <eblake@redhat.com>
26ba25
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
26ba25
RH-Acked-by: Fam Zheng <famz@redhat.com>
26ba25
26ba25
From: Eric Blake <eblake@redhat.com>
26ba25
26ba25
In my hurry to fix a build failure, I introduced a logic bug.
26ba25
The assertion conditional is backwards, meaning that qemu will
26ba25
now abort instead of reporting dirty bitmap status.
26ba25
26ba25
The bug can only be tickled by an NBD client using an exported
26ba25
dirty bitmap (which is still an experimental QMP command), so
26ba25
it's not the end of the world for supported usage (and neither
26ba25
'make check' nor qemu-iotests fails); but it also shows that we
26ba25
really want qemu-io support for reading dirty bitmaps if only
26ba25
so that I can add iotests coverage to prevent future
26ba25
brown-bag-of-shame events like this one.
26ba25
26ba25
Fixes: 45eb6fb6
26ba25
Signed-off-by: Eric Blake <eblake@redhat.com>
26ba25
Message-Id: <20180622153509.375130-1-eblake@redhat.com>
26ba25
(cherry picked from commit 7606c99a0421be7e9d984766fe239f7791a2fd9c)
26ba25
Signed-off-by: John Snow <jsnow@redhat.com>
26ba25
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
26ba25
---
26ba25
 nbd/server.c | 2 +-
26ba25
 1 file changed, 1 insertion(+), 1 deletion(-)
26ba25
26ba25
diff --git a/nbd/server.c b/nbd/server.c
26ba25
index 50ac8bf..e52b76b 100644
26ba25
--- a/nbd/server.c
26ba25
+++ b/nbd/server.c
26ba25
@@ -1977,7 +1977,7 @@ static unsigned int bitmap_to_extents(BdrvDirtyBitmap *bitmap, uint64_t offset,
26ba25
 
26ba25
     bdrv_dirty_bitmap_unlock(bitmap);
26ba25
 
26ba25
-    assert(offset > end);
26ba25
+    assert(offset < end);
26ba25
     *length = end - offset;
26ba25
     return i;
26ba25
 }
26ba25
-- 
26ba25
1.8.3.1
26ba25