Skip to contentSkip to conversation

qcow2: move qcow2_store_persistent_dirty_bitmaps() before cache flushing

PATCH Applied Pavel Butsykin 3 participants 4 messages Sep 4, 2017 – Sep 6, 2017 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qcow2: move qcow2_store_persistent_dirty_bitmaps() before cache flushing

After calling qcow2_inactivate(), all qcow2 caches must be flushed, but this may not happen, because the last call qcow2_store_persistent_dirty_bitmaps() can lead to marking l2/refcont cache as dirty.

Let's move qcow2_store_persistent_dirty_bitmaps() before the caсhe flushing to fix it.

---
 block/qcow2.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
block/qcow2.c +8 -8
index a3679c69e8..dcf49084c5 100644
@@ -2037,6 +2037,14 @@ static int qcow2_inactivate(BlockDriverState *bs)
     int ret, result = 0;
     Error *local_err = NULL;
 
+    qcow2_store_persistent_dirty_bitmaps(bs, &local_err);
+    if (local_err != NULL) {
+        result = -EINVAL;
+        error_report_err(local_err);
+        error_report("Persistent bitmaps are lost for node '%s'",
+                     bdrv_get_device_or_node_name(bs));
+    }
+
     ret = qcow2_cache_flush(bs, s->l2_table_cache);
     if (ret) {
         result = ret;
@@ -2051,14 +2059,6 @@ static int qcow2_inactivate(BlockDriverState *bs)
                      strerror(-ret));
     }
 
-    qcow2_store_persistent_dirty_bitmaps(bs, &local_err);
-    if (local_err != NULL) {
-        result = -EINVAL;
-        error_report_err(local_err);
-        error_report("Persistent bitmaps are lost for node '%s'",
-                     bdrv_get_device_or_node_name(bs));
-    }
-
     if (result == 0) {
         qcow2_mark_clean(bs);
     }
Signature · 1 line
2.14.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Pavel Butsykin

After calling qcow2_inactivate(), all qcow2 caches must be flushed, but this may not happen, because the last call qcow2_store_persistent_dirty_bitmaps() can lead to marking l2/refcont cache as dirty.

Quoted 8 lines

Let's move qcow2_store_persistent_dirty_bitmaps() before the caсhe flushing to fix it.

---
 block/qcow2.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Should this cc: qemu-stable?

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#2 lore raw
Quoted 8 lines · Eric Blake
Quoted 7 lines · Pavel Butsykin

After calling qcow2_inactivate(), all qcow2 caches must be flushed, but this may not happen, because the last call qcow2_store_persistent_dirty_bitmaps() can lead to marking l2/refcont cache as dirty.

Let's move qcow2_store_persistent_dirty_bitmaps() before the caсhe flushing to fix it.

Quoted 7 lines
Quoted 5 lines
---
  block/qcow2.c | 16 ++++++++--------
  1 file changed, 8 insertions(+), 8 deletions(-)

Should this cc: qemu-stable?

The latest stable branch (2.8?) doesn't contain the persistent dirty bitmap.

Quoted 2 lines
Applied
#3 lore raw

Am 06.09.2017 um 10:19 hat Pavel Butsykin geschrieben:

Quoted 15 lines · Eric Blake
Quoted 14 lines · Pavel Butsykin
Quoted 12 lines

After calling qcow2_inactivate(), all qcow2 caches must be flushed, but this may not happen, because the last call qcow2_store_persistent_dirty_bitmaps() can lead to marking l2/refcont cache as dirty.

Let's move qcow2_store_persistent_dirty_bitmaps() before the caсhe flushing to fix it.

---
  block/qcow2.c | 16 ++++++++--------
  1 file changed, 8 insertions(+), 8 deletions(-)
Quoted 3 lines
Quoted 1 line

Should this cc: qemu-stable?

The latest stable branch (2.8?) doesn't contain the persistent dirty bitmap.

Cc: qemu-stable would now be for qemu 2.10.1, which I think does need the fix. I'm adding the tag.

Thanks, applied to the block branch.

Kevin