[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 6/8] qcow2: Free allocated L2 cluster on error
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 6/8] qcow2: Free allocated L2 cluster on error |
Date: |
Mon, 7 Oct 2013 13:28:07 +0200 |
From: Max Reitz <address@hidden>
If an error occurs in l2_allocate, the allocated (but unused) L2 cluster
should be freed.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Benoit Canet <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block/qcow2-cluster.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 2ed45f0..0fd26bb 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -273,6 +273,10 @@ fail:
qcow2_cache_put(bs, s->l2_table_cache, (void**) table);
}
s->l1_table[l1_index] = old_l2_offset;
+ if (l2_offset > 0) {
+ qcow2_free_clusters(bs, l2_offset, s->l2_size * sizeof(uint64_t),
+ QCOW2_DISCARD_ALWAYS);
+ }
return ret;
}
--
1.8.3.1
- [Qemu-devel] [PULL 0/8] Block patches, Stefan Hajnoczi, 2013/10/07
- [Qemu-devel] [PULL 1/8] qcow2: Correct endianness in overlap check, Stefan Hajnoczi, 2013/10/07
- [Qemu-devel] [PULL 2/8] qcow2: CHECK_OFLAG_COPIED is obsolete, Stefan Hajnoczi, 2013/10/07
- [Qemu-devel] [PULL 3/8] block: use correct filename for error report, Stefan Hajnoczi, 2013/10/07
- [Qemu-devel] [PULL 4/8] block: vhdx - add migration blocker, Stefan Hajnoczi, 2013/10/07
- [Qemu-devel] [PULL 6/8] qcow2: Free allocated L2 cluster on error,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 5/8] qcow2: Switch L1 table in a single sequence, Stefan Hajnoczi, 2013/10/07
- [Qemu-devel] [PULL 7/8] qemu-iotests: Correct 026 output, Stefan Hajnoczi, 2013/10/07
- [Qemu-devel] [PULL 8/8] block: use correct filename, Stefan Hajnoczi, 2013/10/07