Skip to contentSkip to conversation

qcow2: Remove abort on free_clusters failure

PATCH In review Kevin Wolf 2 participants 3 messages Apr 27, 2010 Block layer

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 qcow2: Remove abort on free_clusters failure

While it's true that during regular operation free_clusters failure would be a bug, an I/O error can always happen. There's no need to kill the VM, the worst thing that can happen (and it will) is that we leak some clusters.

---
 block/qcow2-refcount.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
block/qcow2-refcount.c +1 -1
index 95491d3..744107c 100644
@@ -638,7 +638,7 @@ void qcow2_free_clusters(BlockDriverState *bs,
     ret = update_refcount(bs, offset, size, -1);
     if (ret < 0) {
         fprintf(stderr, "qcow2_free_clusters failed: %s\n", strerror(-ret));
-        abort();
+        /* TODO Remember the clusters to free them later and avoid leaking */
     }
 }
 
Signature · 1 line
1.6.6.1
#1 lore raw

block/qcow2-refcount.c void qcow2_free_clusters(BlockDriverState *bs, · line 643

Quoted 10 lines · Kevin Wolf
block/qcow2-refcount.c +1 -1
@@ -638,7 +638,7 @@ void qcow2_free_clusters(BlockDriverState *bs,
     ret = update_refcount(bs, offset, size, -1);
     if (ret < 0) {
         fprintf(stderr, "qcow2_free_clusters failed: %s\n", strerror(-ret));
-        abort();
+        /* TODO Remember the clusters to free them later and avoid leaking */
     }
  }

Has there been discussion on a fix mode for qemu-img check? For qcow2 it could write new refcounts, calculated by traversing the L1/L2 tables of the image and snapshots. Perhaps it would also dump out the orphaned clusters to a lost+found.

Stefan

author
#2 lore raw

Am 27.04.2010 14:52, schrieb Stefan Hajnoczi:

Quoted 8 lines · Kevin Wolf
Quoted 7 lines
block/qcow2-refcount.c +0 -1
@@ -638,7 +638,7 @@ void qcow2_free_clusters(BlockDriverState *bs,
    ret = update_refcount(bs, offset, size, -1);
    if (ret < 0) {
        fprintf(stderr, "qcow2_free_clusters failed: %s\n", strerror(-ret));
-        abort();
Quoted 8 lines

block/qcow2-refcount.c void qcow2_free_clusters(BlockDriverState *bs, · line 643

Quoted 3 lines
block/qcow2-refcount.c +1 -0
+        /* TODO Remember the clusters to free them later and avoid leaking */
    }
 }

Has there been discussion on a fix mode for qemu-img check? For qcow2 it could write new refcounts, calculated by traversing the L1/L2 tables of the image and snapshots. Perhaps it would also dump out the orphaned clusters to a lost+found.

No real discussion, but it's somewhere among the low priority tasks on my todo list. So I agree this would make sense, at least for the trivial errors.

Another thing I was considering is to distinguish between errors and warnings in qemu-img check. I keep getting reports about image corruption which turn out to be just some leaked clusters because they killed their qemu process at some point.

Kevin