Skip to contentSkip to conversation

Block layer patches for 2.8.0-rc3

GIT PULL Applied Kevin Wolf 2 participants 3 messages Dec 6, 2016 Block layer

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

The following changes since commit bc66cedb4141fb7588f2462c74310d8fb5dd4cf1:

Merge remote-tracking branch 'yongbok/tags/mips-20161204' into staging (2016-12-05 10:56:45 +0000)

are available in the git repository at:

git://repo.or.cz/qemu/kevin.git tags/for-upstream

for you to fetch changes up to a3e1505daec31ef56f0489f8c8fff1b8e4ca92bd:

qcow2: Don't strand clusters near 2G intervals during commit (2016-12-06 15:37:02 +0100)

----------------------------------------------------------------
Block layer patches for 2.8.0-rc3

----------------------------------------------------------------
Eric Blake (1):
qcow2: Don't strand clusters near 2G intervals during commit

 block/qcow2.c              |   3 +-
 tests/qemu-iotests/097     |  41 +++++---
 tests/qemu-iotests/097.out | 249 +++++++++++++++++++++++++++++++++------------
 3 files changed, 210 insertions(+), 83 deletions(-)
author
#1 lore raw

[Qemu-devel] [PULL] qcow2: Don't strand clusters near 2G intervals during commit

From: Eric Blake <[email protected]>

The qcow2_make_empty() function is reached during 'qemu-img commit', in order to clear out ALL clusters of an image. However, if the image cannot use the fast code path (true if the image is format 0.10, or if the image contains a snapshot), the cluster size is larger than 512, and the image is larger than 2G in size, then our choice of sector_step causes problems. Since it is not cluster aligned, but qcow2_discard_clusters() silently ignores an unaligned head or tail, we are leaving clusters allocated.

Enhance the testsuite to expose the flaw, and patch the problem by ensuring our step size is aligned.

---
 block/qcow2.c              |   3 +-
 tests/qemu-iotests/097     |  41 +++++---
 tests/qemu-iotests/097.out | 249 +++++++++++++++++++++++++++++++++------------
 3 files changed, 210 insertions(+), 83 deletions(-)
block/qcow2.c +2 -1
index ed9e0f3..96fb8a8 100644
@@ -2808,7 +2808,8 @@ static int qcow2_make_empty(BlockDriverState *bs)
 {
     BDRVQcow2State *s = bs->opaque;
     uint64_t start_sector;
-    int sector_step = INT_MAX / BDRV_SECTOR_SIZE;
+    int sector_step = (QEMU_ALIGN_DOWN(INT_MAX, s->cluster_size) /
+                       BDRV_SECTOR_SIZE);
     int l1_clusters, ret = 0;
 
     l1_clusters = DIV_ROUND_UP(s->l1_size, s->cluster_size / sizeof(uint64_t));
tests/qemu-iotests/097 +25 -16

81 lines not on this page · raw message

tests/qemu-iotests/097.out +183 -66

302 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#2 lore raw
In reply to Kevin Wolf
Quoted 16 lines · Kevin Wolf

The following changes since commit bc66cedb4141fb7588f2462c74310d8fb5dd4cf1:

Merge remote-tracking branch 'yongbok/tags/mips-20161204' into staging (2016-12-05 10:56:45 +0000)

are available in the git repository at:

git://repo.or.cz/qemu/kevin.git tags/for-upstream

for you to fetch changes up to a3e1505daec31ef56f0489f8c8fff1b8e4ca92bd:

qcow2: Don't strand clusters near 2G intervals during commit (2016-12-06 15:37:02 +0100)

----------------------------------------------------------------
Block layer patches for 2.8.0-rc3

Quoted 9 lines

----------------------------------------------------------------
Eric Blake (1):
qcow2: Don't strand clusters near 2G intervals during commit

 block/qcow2.c              |   3 +-
 tests/qemu-iotests/097     |  41 +++++---
 tests/qemu-iotests/097.out | 249 +++++++++++++++++++++++++++++++++------------
 3 files changed, 210 insertions(+), 83 deletions(-)

Thanks, applied to my staging tree:
https://github.com/stefanha/qemu/commits/staging

Stefan