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