1 | The following changes since commit 23919ddfd56135cad3cb468a8f54d5a595f024f4: | 1 | The following changes since commit dd25f97c66a75d1508f1d4c6478ed2c95bec428f: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/aperard/tags/pull-xen-20190827' into staging (2019-08-27 15:52:36 +0100) | 3 | Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20190913' into staging (2019-09-16 10:15:15 +0100) |
4 | 4 | ||
5 | are available in the Git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | https://github.com/XanClic/qemu.git tags/pull-block-2019-08-27 | 7 | https://github.com/XanClic/qemu.git tags/pull-block-2019-09-16 |
8 | 8 | ||
9 | for you to fetch changes up to bb043c056cffcc2f3ce88bfdaf2e76e455c09e2c: | 9 | for you to fetch changes up to 1825cc0783ccf0ec5d9f0b225a99b340bdd4c68f: |
10 | 10 | ||
11 | iotests: Unify cache mode quoting (2019-08-27 19:48:44 +0200) | 11 | qemu-iotests: Add test for bz #1745922 (2019-09-16 15:37:12 +0200) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Block patches: | 14 | Block patches: |
15 | - qemu-io now accepts a file to read a write pattern from | 15 | - Fix for block jobs when used with I/O threads |
16 | - Ensure that raw files have their first block allocated so we can probe | 16 | - Fix for a corruption when using qcow2's LUKS encryption mode |
17 | the O_DIRECT alignment if necessary | 17 | - cURL fix |
18 | - Various fixes | 18 | - check-block.sh cleanups (for make check) |
19 | - Refactoring | ||
19 | 20 | ||
20 | ---------------------------------------------------------------- | 21 | ---------------------------------------------------------------- |
21 | Denis Plotnikov (1): | 22 | Max Reitz (7): |
22 | qemu-io: add pattern file for write command | 23 | curl: Keep pointer to the CURLState in CURLSocket |
24 | curl: Keep *socket until the end of curl_sock_cb() | ||
25 | curl: Check completion in curl_multi_do() | ||
26 | curl: Pass CURLSocket to curl_multi_do() | ||
27 | curl: Report only ready sockets | ||
28 | curl: Handle success in multi_check_completion | ||
29 | curl: Check curl_multi_add_handle()'s return code | ||
23 | 30 | ||
24 | Max Reitz (7): | 31 | Maxim Levitsky (3): |
25 | iotests: Fix _filter_img_create() | 32 | block/qcow2: Fix corruption introduced by commit 8ac0f15f335 |
26 | vmdk: Use bdrv_dirname() for relative extent paths | 33 | block/qcow2: refactor encryption code |
27 | iotests: Keep testing broken relative extent paths | 34 | qemu-iotests: Add test for bz #1745922 |
28 | vmdk: Reject invalid compressed writes | ||
29 | iotests: Disable broken streamOptimized tests | ||
30 | iotests: Disable 110 for vmdk.twoGbMaxExtentSparse | ||
31 | iotests: Disable 126 for flat vmdk subformats | ||
32 | 35 | ||
33 | Nir Soffer (3): | 36 | Nir Soffer (2): |
34 | block: posix: Always allocate the first block | 37 | block: Use QEMU_IS_ALIGNED |
35 | iotests: Test allocate_first_block() with O_DIRECT | 38 | block: Remove unused masks |
36 | iotests: Unify cache mode quoting | ||
37 | 39 | ||
38 | Stefan Hajnoczi (1): | 40 | Sergio Lopez (1): |
39 | file-posix: fix request_alignment typo | 41 | blockjob: update nodes head while removing all bdrv |
40 | 42 | ||
41 | Thomas Huth (2): | 43 | Thomas Huth (2): |
42 | iotests: Check for enabled drivers before testing them | 44 | tests/qemu-iotests/check: Replace "tests" with "iotests" in final |
43 | tests/check-block: Skip iotests when sanitizers are enabled | 45 | status text |
46 | tests/Makefile: Do not print the name of the check-block.sh shell | ||
47 | script | ||
44 | 48 | ||
45 | Vladimir Sementsov-Ogievskiy (1): | 49 | Vladimir Sementsov-Ogievskiy (1): |
46 | block: fix permission update in bdrv_replace_node | 50 | tests/qemu-iotests: Fix qemu-io related output in 026.out.nocache |
47 | 51 | ||
48 | block.c | 5 +- | 52 | tests/Makefile.include | 2 +- |
49 | block/file-posix.c | 53 +++++++++- | 53 | block/qcow2.h | 8 +- |
50 | block/vmdk.c | 64 ++++++++---- | 54 | include/block/block.h | 2 - |
51 | qemu-io-cmds.c | 99 +++++++++++++++++-- | 55 | block/bochs.c | 4 +- |
52 | tests/check-block.sh | 5 + | 56 | block/cloop.c | 4 +- |
53 | tests/qemu-iotests/002 | 1 + | 57 | block/curl.c | 133 ++++++++++------------- |
54 | tests/qemu-iotests/003 | 1 + | 58 | block/dmg.c | 4 +- |
55 | tests/qemu-iotests/005 | 3 +- | 59 | block/io.c | 8 +- |
56 | tests/qemu-iotests/009 | 1 + | 60 | block/qcow2-cluster.c | 40 +++---- |
57 | tests/qemu-iotests/010 | 1 + | 61 | block/qcow2-threads.c | 63 ++++++++--- |
58 | tests/qemu-iotests/011 | 1 + | 62 | block/qcow2.c | 9 +- |
59 | tests/qemu-iotests/017 | 3 +- | 63 | block/vvfat.c | 8 +- |
60 | tests/qemu-iotests/018 | 3 +- | 64 | blockjob.c | 17 ++- |
61 | tests/qemu-iotests/019 | 3 +- | 65 | migration/block.c | 2 +- |
62 | tests/qemu-iotests/020 | 3 +- | 66 | qemu-img.c | 2 +- |
63 | tests/qemu-iotests/026 | 4 +- | 67 | tests/qemu-iotests/026.out.nocache | 168 ++++++++++++++--------------- |
64 | tests/qemu-iotests/027 | 1 + | 68 | tests/qemu-iotests/263 | 91 ++++++++++++++++ |
65 | tests/qemu-iotests/032 | 1 + | 69 | tests/qemu-iotests/263.out | 40 +++++++ |
66 | tests/qemu-iotests/033 | 1 + | 70 | tests/qemu-iotests/check | 8 +- |
67 | tests/qemu-iotests/034 | 3 +- | 71 | tests/qemu-iotests/group | 1 + |
68 | tests/qemu-iotests/037 | 3 +- | 72 | 20 files changed, 380 insertions(+), 234 deletions(-) |
69 | tests/qemu-iotests/039 | 4 +- | 73 | create mode 100755 tests/qemu-iotests/263 |
70 | tests/qemu-iotests/052 | 2 +- | 74 | create mode 100644 tests/qemu-iotests/263.out |
71 | tests/qemu-iotests/059 | 34 ++++++- | ||
72 | tests/qemu-iotests/059.out | 26 +++-- | ||
73 | tests/qemu-iotests/063 | 3 +- | ||
74 | tests/qemu-iotests/071 | 1 + | ||
75 | tests/qemu-iotests/072 | 1 + | ||
76 | tests/qemu-iotests/081 | 4 +- | ||
77 | tests/qemu-iotests/091 | 4 +- | ||
78 | tests/qemu-iotests/099 | 1 + | ||
79 | tests/qemu-iotests/105 | 3 +- | ||
80 | tests/qemu-iotests/110 | 3 +- | ||
81 | tests/qemu-iotests/120 | 1 + | ||
82 | tests/qemu-iotests/126 | 2 + | ||
83 | tests/qemu-iotests/{150.out => 150.out.qcow2} | 0 | ||
84 | tests/qemu-iotests/150.out.raw | 12 +++ | ||
85 | tests/qemu-iotests/162 | 4 +- | ||
86 | tests/qemu-iotests/175 | 47 +++++++-- | ||
87 | tests/qemu-iotests/175.out | 16 ++- | ||
88 | tests/qemu-iotests/178.out.qcow2 | 4 +- | ||
89 | tests/qemu-iotests/184 | 1 + | ||
90 | tests/qemu-iotests/186 | 1 + | ||
91 | tests/qemu-iotests/197 | 1 + | ||
92 | tests/qemu-iotests/215 | 1 + | ||
93 | tests/qemu-iotests/221.out | 12 ++- | ||
94 | tests/qemu-iotests/251 | 1 + | ||
95 | tests/qemu-iotests/253.out | 12 ++- | ||
96 | tests/qemu-iotests/common.filter | 4 +- | ||
97 | tests/qemu-iotests/common.rc | 14 +++ | ||
98 | 50 files changed, 391 insertions(+), 87 deletions(-) | ||
99 | rename tests/qemu-iotests/{150.out => 150.out.qcow2} (100%) | ||
100 | create mode 100644 tests/qemu-iotests/150.out.raw | ||
101 | 75 | ||
102 | -- | 76 | -- |
103 | 2.21.0 | 77 | 2.21.0 |
104 | 78 | ||
105 | 79 | diff view generated by jsdifflib |
1 | From: Nir Soffer <nirsof@gmail.com> | 1 | From: Nir Soffer <nirsof@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | Using block_resize we can test allocate_first_block() with file | 3 | Replace instances of: |
4 | descriptor opened with O_DIRECT, ensuring that it works for any size | ||
5 | larger than 4096 bytes. | ||
6 | 4 | ||
7 | Testing smaller sizes is tricky as the result depends on the filesystem | 5 | (n & (BDRV_SECTOR_SIZE - 1)) == 0 |
8 | used for testing. For example on NFS any size will work since O_DIRECT | 6 | |
9 | does not require any alignment. | 7 | And: |
8 | |||
9 | (n & ~BDRV_SECTOR_MASK) == 0 | ||
10 | |||
11 | With: | ||
12 | |||
13 | QEMU_IS_ALIGNED(n, BDRV_SECTOR_SIZE) | ||
14 | |||
15 | Which reveals the intent of the code better, and makes it easier to | ||
16 | locate the code checking alignment. | ||
10 | 17 | ||
11 | Signed-off-by: Nir Soffer <nsoffer@redhat.com> | 18 | Signed-off-by: Nir Soffer <nsoffer@redhat.com> |
12 | Reviewed-by: Max Reitz <mreitz@redhat.com> | 19 | Message-id: 20190827185913.27427-2-nsoffer@redhat.com |
13 | Message-id: 20190827010528.8818-3-nsoffer@redhat.com | 20 | Reviewed-by: John Snow <jsnow@redhat.com> |
14 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 21 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
15 | --- | 22 | --- |
16 | tests/qemu-iotests/175 | 28 ++++++++++++++++++++++++++++ | 23 | block/bochs.c | 4 ++-- |
17 | tests/qemu-iotests/175.out | 8 ++++++++ | 24 | block/cloop.c | 4 ++-- |
18 | 2 files changed, 36 insertions(+) | 25 | block/dmg.c | 4 ++-- |
26 | block/io.c | 8 ++++---- | ||
27 | block/qcow2-cluster.c | 4 ++-- | ||
28 | block/qcow2.c | 4 ++-- | ||
29 | block/vvfat.c | 8 ++++---- | ||
30 | qemu-img.c | 2 +- | ||
31 | 8 files changed, 19 insertions(+), 19 deletions(-) | ||
19 | 32 | ||
20 | diff --git a/tests/qemu-iotests/175 b/tests/qemu-iotests/175 | 33 | diff --git a/block/bochs.c b/block/bochs.c |
21 | index XXXXXXX..XXXXXXX 100755 | ||
22 | --- a/tests/qemu-iotests/175 | ||
23 | +++ b/tests/qemu-iotests/175 | ||
24 | @@ -XXX,XX +XXX,XX @@ _filter_blocks() | ||
25 | -e "s/blocks=$((extra_blocks + img_size / 512))\\(\$\\|[^0-9]\\)/max allocation/" | ||
26 | } | ||
27 | |||
28 | +# Resize image using block_resize. | ||
29 | +# Parameter 1: image path | ||
30 | +# Parameter 2: new size | ||
31 | +_block_resize() | ||
32 | +{ | ||
33 | + local path=$1 | ||
34 | + local size=$2 | ||
35 | + | ||
36 | + $QEMU -qmp stdio -nographic -nodefaults \ | ||
37 | + -blockdev file,node-name=file,filename=$path,cache.direct=on \ | ||
38 | + <<EOF | ||
39 | +{'execute': 'qmp_capabilities'} | ||
40 | +{'execute': 'block_resize', 'arguments': {'node-name': 'file', 'size': $size}} | ||
41 | +{'execute': 'quit'} | ||
42 | +EOF | ||
43 | +} | ||
44 | + | ||
45 | # get standard environment, filters and checks | ||
46 | . ./common.rc | ||
47 | . ./common.filter | ||
48 | @@ -XXX,XX +XXX,XX @@ _supported_fmt raw | ||
49 | _supported_proto file | ||
50 | _supported_os Linux | ||
51 | |||
52 | +_default_cache_mode none | ||
53 | +_supported_cache_modes none directsync | ||
54 | + | ||
55 | size=$((1 * 1024 * 1024)) | ||
56 | |||
57 | touch "$TEST_DIR/empty" | ||
58 | @@ -XXX,XX +XXX,XX @@ for mode in off full falloc; do | ||
59 | stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $min_blocks $size | ||
60 | done | ||
61 | |||
62 | +for new_size in 4096 1048576; do | ||
63 | + echo | ||
64 | + echo "== resize empty image with block_resize ==" | ||
65 | + _make_test_img 0 | _filter_imgfmt | ||
66 | + _block_resize $TEST_IMG $new_size >/dev/null | ||
67 | + stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $min_blocks $new_size | ||
68 | +done | ||
69 | + | ||
70 | # success, all done | ||
71 | echo "*** done" | ||
72 | rm -f $seq.full | ||
73 | diff --git a/tests/qemu-iotests/175.out b/tests/qemu-iotests/175.out | ||
74 | index XXXXXXX..XXXXXXX 100644 | 34 | index XXXXXXX..XXXXXXX 100644 |
75 | --- a/tests/qemu-iotests/175.out | 35 | --- a/block/bochs.c |
76 | +++ b/tests/qemu-iotests/175.out | 36 | +++ b/block/bochs.c |
77 | @@ -XXX,XX +XXX,XX @@ size=1048576, max allocation | 37 | @@ -XXX,XX +XXX,XX @@ bochs_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, |
78 | == creating image with preallocation falloc == | 38 | QEMUIOVector local_qiov; |
79 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=falloc | 39 | int ret; |
80 | size=1048576, max allocation | 40 | |
81 | + | 41 | - assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); |
82 | +== resize empty image with block_resize == | 42 | - assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); |
83 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=0 | 43 | + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); |
84 | +size=4096, min allocation | 44 | + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); |
85 | + | 45 | |
86 | +== resize empty image with block_resize == | 46 | qemu_iovec_init(&local_qiov, qiov->niov); |
87 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=0 | 47 | qemu_co_mutex_lock(&s->lock); |
88 | +size=1048576, min allocation | 48 | diff --git a/block/cloop.c b/block/cloop.c |
89 | *** done | 49 | index XXXXXXX..XXXXXXX 100644 |
50 | --- a/block/cloop.c | ||
51 | +++ b/block/cloop.c | ||
52 | @@ -XXX,XX +XXX,XX @@ cloop_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, | ||
53 | int nb_sectors = bytes >> BDRV_SECTOR_BITS; | ||
54 | int ret, i; | ||
55 | |||
56 | - assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); | ||
57 | - assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); | ||
58 | + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); | ||
59 | + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); | ||
60 | |||
61 | qemu_co_mutex_lock(&s->lock); | ||
62 | |||
63 | diff --git a/block/dmg.c b/block/dmg.c | ||
64 | index XXXXXXX..XXXXXXX 100644 | ||
65 | --- a/block/dmg.c | ||
66 | +++ b/block/dmg.c | ||
67 | @@ -XXX,XX +XXX,XX @@ dmg_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, | ||
68 | int nb_sectors = bytes >> BDRV_SECTOR_BITS; | ||
69 | int ret, i; | ||
70 | |||
71 | - assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); | ||
72 | - assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); | ||
73 | + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); | ||
74 | + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); | ||
75 | |||
76 | qemu_co_mutex_lock(&s->lock); | ||
77 | |||
78 | diff --git a/block/io.c b/block/io.c | ||
79 | index XXXXXXX..XXXXXXX 100644 | ||
80 | --- a/block/io.c | ||
81 | +++ b/block/io.c | ||
82 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_driver_preadv(BlockDriverState *bs, | ||
83 | sector_num = offset >> BDRV_SECTOR_BITS; | ||
84 | nb_sectors = bytes >> BDRV_SECTOR_BITS; | ||
85 | |||
86 | - assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); | ||
87 | - assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); | ||
88 | + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); | ||
89 | + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); | ||
90 | assert(bytes <= BDRV_REQUEST_MAX_BYTES); | ||
91 | assert(drv->bdrv_co_readv); | ||
92 | |||
93 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_driver_pwritev(BlockDriverState *bs, | ||
94 | sector_num = offset >> BDRV_SECTOR_BITS; | ||
95 | nb_sectors = bytes >> BDRV_SECTOR_BITS; | ||
96 | |||
97 | - assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); | ||
98 | - assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); | ||
99 | + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); | ||
100 | + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); | ||
101 | assert(bytes <= BDRV_REQUEST_MAX_BYTES); | ||
102 | |||
103 | assert(drv->bdrv_co_writev); | ||
104 | diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c | ||
105 | index XXXXXXX..XXXXXXX 100644 | ||
106 | --- a/block/qcow2-cluster.c | ||
107 | +++ b/block/qcow2-cluster.c | ||
108 | @@ -XXX,XX +XXX,XX @@ static bool coroutine_fn do_perform_cow_encrypt(BlockDriverState *bs, | ||
109 | { | ||
110 | if (bytes && bs->encrypted) { | ||
111 | BDRVQcow2State *s = bs->opaque; | ||
112 | - assert((offset_in_cluster & ~BDRV_SECTOR_MASK) == 0); | ||
113 | - assert((bytes & ~BDRV_SECTOR_MASK) == 0); | ||
114 | + assert(QEMU_IS_ALIGNED(offset_in_cluster, BDRV_SECTOR_SIZE)); | ||
115 | + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); | ||
116 | assert(s->crypto); | ||
117 | if (qcow2_co_encrypt(bs, cluster_offset, | ||
118 | src_cluster_offset + offset_in_cluster, | ||
119 | diff --git a/block/qcow2.c b/block/qcow2.c | ||
120 | index XXXXXXX..XXXXXXX 100644 | ||
121 | --- a/block/qcow2.c | ||
122 | +++ b/block/qcow2.c | ||
123 | @@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow2_co_preadv_part(BlockDriverState *bs, | ||
124 | goto fail; | ||
125 | } | ||
126 | |||
127 | - assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); | ||
128 | - assert((cur_bytes & (BDRV_SECTOR_SIZE - 1)) == 0); | ||
129 | + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); | ||
130 | + assert(QEMU_IS_ALIGNED(cur_bytes, BDRV_SECTOR_SIZE)); | ||
131 | if (qcow2_co_decrypt(bs, cluster_offset, offset, | ||
132 | cluster_data, cur_bytes) < 0) { | ||
133 | ret = -EIO; | ||
134 | diff --git a/block/vvfat.c b/block/vvfat.c | ||
135 | index XXXXXXX..XXXXXXX 100644 | ||
136 | --- a/block/vvfat.c | ||
137 | +++ b/block/vvfat.c | ||
138 | @@ -XXX,XX +XXX,XX @@ vvfat_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, | ||
139 | int nb_sectors = bytes >> BDRV_SECTOR_BITS; | ||
140 | void *buf; | ||
141 | |||
142 | - assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); | ||
143 | - assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); | ||
144 | + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); | ||
145 | + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); | ||
146 | |||
147 | buf = g_try_malloc(bytes); | ||
148 | if (bytes && buf == NULL) { | ||
149 | @@ -XXX,XX +XXX,XX @@ vvfat_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes, | ||
150 | int nb_sectors = bytes >> BDRV_SECTOR_BITS; | ||
151 | void *buf; | ||
152 | |||
153 | - assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); | ||
154 | - assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); | ||
155 | + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); | ||
156 | + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); | ||
157 | |||
158 | buf = g_try_malloc(bytes); | ||
159 | if (bytes && buf == NULL) { | ||
160 | diff --git a/qemu-img.c b/qemu-img.c | ||
161 | index XXXXXXX..XXXXXXX 100644 | ||
162 | --- a/qemu-img.c | ||
163 | +++ b/qemu-img.c | ||
164 | @@ -XXX,XX +XXX,XX @@ static int img_convert(int argc, char **argv) | ||
165 | int64_t sval; | ||
166 | |||
167 | sval = cvtnum(optarg); | ||
168 | - if (sval < 0 || sval & (BDRV_SECTOR_SIZE - 1) || | ||
169 | + if (sval < 0 || !QEMU_IS_ALIGNED(sval, BDRV_SECTOR_SIZE) || | ||
170 | sval / BDRV_SECTOR_SIZE > MAX_BUF_SECTORS) { | ||
171 | error_report("Invalid buffer size for sparse output specified. " | ||
172 | "Valid sizes are multiples of %llu up to %llu. Select " | ||
90 | -- | 173 | -- |
91 | 2.21.0 | 174 | 2.21.0 |
92 | 175 | ||
93 | 176 | diff view generated by jsdifflib |
1 | From: Nir Soffer <nirsof@gmail.com> | 1 | From: Nir Soffer <nirsof@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | Quoting cache mode is not needed, and most tests use unquoted values. | 3 | Replace confusing usage: |
4 | Unify all test to use the same style. | ||
5 | 4 | ||
6 | Message-id: 20190827173432.7656-1-nsoffer@redhat.com | 5 | ~BDRV_SECTOR_MASK |
6 | |||
7 | With more clear: | ||
8 | |||
9 | (BDRV_SECTOR_SIZE - 1) | ||
10 | |||
11 | Remove BDRV_SECTOR_MASK and the unused BDRV_BLOCK_OFFSET_MASK which was | ||
12 | it's last user. | ||
13 | |||
7 | Signed-off-by: Nir Soffer <nsoffer@redhat.com> | 14 | Signed-off-by: Nir Soffer <nsoffer@redhat.com> |
15 | Message-id: 20190827185913.27427-3-nsoffer@redhat.com | ||
16 | Reviewed-by: Juan Quintela <quintela@redhat.com> | ||
17 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
8 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 18 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
9 | --- | 19 | --- |
10 | tests/qemu-iotests/026 | 4 ++-- | 20 | include/block/block.h | 2 -- |
11 | tests/qemu-iotests/039 | 4 ++-- | 21 | migration/block.c | 2 +- |
12 | tests/qemu-iotests/052 | 2 +- | 22 | 2 files changed, 1 insertion(+), 3 deletions(-) |
13 | tests/qemu-iotests/091 | 4 ++-- | ||
14 | 4 files changed, 7 insertions(+), 7 deletions(-) | ||
15 | 23 | ||
16 | diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026 | 24 | diff --git a/include/block/block.h b/include/block/block.h |
17 | index XXXXXXX..XXXXXXX 100755 | 25 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/tests/qemu-iotests/026 | 26 | --- a/include/block/block.h |
19 | +++ b/tests/qemu-iotests/026 | 27 | +++ b/include/block/block.h |
20 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | 28 | @@ -XXX,XX +XXX,XX @@ typedef struct HDGeometry { |
21 | # Currently only qcow2 supports rebasing | 29 | |
22 | _supported_fmt qcow2 | 30 | #define BDRV_SECTOR_BITS 9 |
23 | _supported_proto file | 31 | #define BDRV_SECTOR_SIZE (1ULL << BDRV_SECTOR_BITS) |
24 | -_default_cache_mode "writethrough" | 32 | -#define BDRV_SECTOR_MASK ~(BDRV_SECTOR_SIZE - 1) |
25 | -_supported_cache_modes "writethrough" "none" | 33 | |
26 | +_default_cache_mode writethrough | 34 | #define BDRV_REQUEST_MAX_SECTORS MIN(SIZE_MAX >> BDRV_SECTOR_BITS, \ |
27 | +_supported_cache_modes writethrough none | 35 | INT_MAX >> BDRV_SECTOR_BITS) |
28 | # The refcount table tests expect a certain minimum width for refcount entries | 36 | @@ -XXX,XX +XXX,XX @@ typedef struct HDGeometry { |
29 | # (so that the refcount table actually needs to grow); that minimum is 16 bits, | 37 | #define BDRV_BLOCK_ALLOCATED 0x10 |
30 | # being the default refcount entry width. | 38 | #define BDRV_BLOCK_EOF 0x20 |
31 | diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039 | 39 | #define BDRV_BLOCK_RECURSE 0x40 |
32 | index XXXXXXX..XXXXXXX 100755 | 40 | -#define BDRV_BLOCK_OFFSET_MASK BDRV_SECTOR_MASK |
33 | --- a/tests/qemu-iotests/039 | 41 | |
34 | +++ b/tests/qemu-iotests/039 | 42 | typedef QSIMPLEQ_HEAD(BlockReopenQueue, BlockReopenQueueEntry) BlockReopenQueue; |
35 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | 43 | |
36 | _supported_fmt qcow2 | 44 | diff --git a/migration/block.c b/migration/block.c |
37 | _supported_proto file | 45 | index XXXXXXX..XXXXXXX 100644 |
38 | _supported_os Linux | 46 | --- a/migration/block.c |
39 | -_default_cache_mode "writethrough" | 47 | +++ b/migration/block.c |
40 | -_supported_cache_modes "writethrough" | 48 | @@ -XXX,XX +XXX,XX @@ static int block_load(QEMUFile *f, void *opaque, int version_id) |
41 | +_default_cache_mode writethrough | 49 | do { |
42 | +_supported_cache_modes writethrough | 50 | addr = qemu_get_be64(f); |
43 | 51 | ||
44 | size=128M | 52 | - flags = addr & ~BDRV_SECTOR_MASK; |
45 | 53 | + flags = addr & (BDRV_SECTOR_SIZE - 1); | |
46 | diff --git a/tests/qemu-iotests/052 b/tests/qemu-iotests/052 | 54 | addr >>= BDRV_SECTOR_BITS; |
47 | index XXXXXXX..XXXXXXX 100755 | 55 | |
48 | --- a/tests/qemu-iotests/052 | 56 | if (flags & BLK_MIG_FLAG_DEVICE_BLOCK) { |
49 | +++ b/tests/qemu-iotests/052 | ||
50 | @@ -XXX,XX +XXX,XX @@ _supported_fmt generic | ||
51 | _supported_proto file | ||
52 | |||
53 | # Don't do O_DIRECT on tmpfs | ||
54 | -_supported_cache_modes "writeback" "writethrough" "unsafe" | ||
55 | +_supported_cache_modes writeback writethrough unsafe | ||
56 | |||
57 | size=128M | ||
58 | _make_test_img $size | ||
59 | diff --git a/tests/qemu-iotests/091 b/tests/qemu-iotests/091 | ||
60 | index XXXXXXX..XXXXXXX 100755 | ||
61 | --- a/tests/qemu-iotests/091 | ||
62 | +++ b/tests/qemu-iotests/091 | ||
63 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
64 | _supported_fmt qcow2 | ||
65 | _supported_proto file | ||
66 | _supported_os Linux | ||
67 | -_default_cache_mode "none" | ||
68 | -_supported_cache_modes "writethrough" "none" "writeback" | ||
69 | +_default_cache_mode none | ||
70 | +_supported_cache_modes writethrough none writeback | ||
71 | |||
72 | size=1G | ||
73 | |||
74 | -- | 57 | -- |
75 | 2.21.0 | 58 | 2.21.0 |
76 | 59 | ||
77 | 60 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | From: Thomas Huth <thuth@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | The sanitizers (especially the address sanitizer from Clang) are | 3 | When running "make check -j8" or something similar, the iotests are |
4 | sometimes printing out warnings or false positives - this spoils | 4 | running in parallel with the other tests. So when they are printing |
5 | the output of the iotests, causing some of the tests to fail. | 5 | out "Passed all xx tests" or a similar status message at the end, |
6 | Thus let's skip the automatic iotests during "make check" when the | 6 | it might not be quite clear that this message belongs to the iotests, |
7 | user configured QEMU with --enable-sanitizers. | 7 | since the output might be mixed with the other tests. Thus change the |
8 | word "tests" here to "iotests" instead to avoid confusion. | ||
8 | 9 | ||
9 | Signed-off-by: Thomas Huth <thuth@redhat.com> | 10 | Signed-off-by: Thomas Huth <thuth@redhat.com> |
10 | Message-id: 20190823084203.29734-1-thuth@redhat.com | 11 | Message-id: 20190906113920.11271-1-thuth@redhat.com |
12 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
11 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 13 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
12 | --- | 14 | --- |
13 | tests/check-block.sh | 5 +++++ | 15 | tests/qemu-iotests/check | 8 ++++---- |
14 | 1 file changed, 5 insertions(+) | 16 | 1 file changed, 4 insertions(+), 4 deletions(-) |
15 | 17 | ||
16 | diff --git a/tests/check-block.sh b/tests/check-block.sh | 18 | diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check |
17 | index XXXXXXX..XXXXXXX 100755 | 19 | index XXXXXXX..XXXXXXX 100755 |
18 | --- a/tests/check-block.sh | 20 | --- a/tests/qemu-iotests/check |
19 | +++ b/tests/check-block.sh | 21 | +++ b/tests/qemu-iotests/check |
20 | @@ -XXX,XX +XXX,XX @@ if grep -q "TARGET_GPROF=y" *-softmmu/config-target.mak 2>/dev/null ; then | 22 | @@ -XXX,XX +XXX,XX @@ END { if (NR > 0) { |
21 | exit 0 | 23 | if [ ! -z "$n_bad" -a $n_bad != 0 ] |
22 | fi | 24 | then |
23 | 25 | echo "Failures:$bad" | |
24 | +if grep -q "CFLAGS.*-fsanitize" config-host.mak 2>/dev/null ; then | 26 | - echo "Failed $n_bad of $try tests" |
25 | + echo "Sanitizers are enabled ==> Not running the qemu-iotests." | 27 | + echo "Failed $n_bad of $try iotests" |
26 | + exit 0 | 28 | echo "Failures:$bad" | fmt >>check.log |
27 | +fi | 29 | - echo "Failed $n_bad of $try tests" >>check.log |
28 | + | 30 | + echo "Failed $n_bad of $try iotests" >>check.log |
29 | if [ -z "$(find . -name 'qemu-system-*' -print)" ]; then | 31 | else |
30 | echo "No qemu-system binary available ==> Not running the qemu-iotests." | 32 | - echo "Passed all $try tests" |
31 | exit 0 | 33 | - echo "Passed all $try tests" >>check.log |
34 | + echo "Passed all $try iotests" | ||
35 | + echo "Passed all $try iotests" >>check.log | ||
36 | fi | ||
37 | needwrap=false | ||
38 | fi | ||
32 | -- | 39 | -- |
33 | 2.21.0 | 40 | 2.21.0 |
34 | 41 | ||
35 | 42 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | From: Thomas Huth <thuth@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | It is possible to enable only a subset of the block drivers with the | 3 | The check script is already printing out which iotest is currently |
4 | "--block-drv-rw-whitelist" option of the "configure" script. All other | 4 | running, so printing out the name of the check-block.sh shell script |
5 | drivers are marked as unusable (or only included as read-only with the | 5 | looks superfluous here. |
6 | "--block-drv-ro-whitelist" option). If an iotest is now using such a | ||
7 | disabled block driver, it is failing - which is bad, since at least the | ||
8 | tests in the "auto" group should be able to deal with this situation. | ||
9 | Thus let's introduce a "_require_drivers" function that can be used by | ||
10 | the shell tests to check for the availability of certain drivers first, | ||
11 | and marks the test as "not run" if one of the drivers is missing. | ||
12 | |||
13 | This patch mainly targets the test in the "auto" group which should | ||
14 | never fail in such a case, but also improves some of the other tests | ||
15 | along the way. Note that we also assume that the "qcow2" and "file" | ||
16 | drivers are always available - otherwise it does not make sense to | ||
17 | run "make check-block" at all (which only tests with qcow2 by default). | ||
18 | 6 | ||
19 | Signed-off-by: Thomas Huth <thuth@redhat.com> | 7 | Signed-off-by: Thomas Huth <thuth@redhat.com> |
20 | Message-id: 20190823133552.11680-1-thuth@redhat.com | 8 | Message-id: 20190906113534.10907-1-thuth@redhat.com |
9 | Acked-by: John Snow <jsnow@redhat.com> | ||
10 | Reviewed-by: Max Reitz <mreitz@redhat.com> | ||
21 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 11 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
22 | --- | 12 | --- |
23 | tests/qemu-iotests/071 | 1 + | 13 | tests/Makefile.include | 2 +- |
24 | tests/qemu-iotests/081 | 4 +--- | 14 | 1 file changed, 1 insertion(+), 1 deletion(-) |
25 | tests/qemu-iotests/099 | 1 + | ||
26 | tests/qemu-iotests/120 | 1 + | ||
27 | tests/qemu-iotests/162 | 4 +--- | ||
28 | tests/qemu-iotests/184 | 1 + | ||
29 | tests/qemu-iotests/186 | 1 + | ||
30 | tests/qemu-iotests/common.rc | 14 ++++++++++++++ | ||
31 | 8 files changed, 21 insertions(+), 6 deletions(-) | ||
32 | 15 | ||
33 | diff --git a/tests/qemu-iotests/071 b/tests/qemu-iotests/071 | 16 | diff --git a/tests/Makefile.include b/tests/Makefile.include |
34 | index XXXXXXX..XXXXXXX 100755 | ||
35 | --- a/tests/qemu-iotests/071 | ||
36 | +++ b/tests/qemu-iotests/071 | ||
37 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
38 | |||
39 | _supported_fmt qcow2 | ||
40 | _supported_proto file | ||
41 | +_require_drivers blkdebug blkverify | ||
42 | |||
43 | do_run_qemu() | ||
44 | { | ||
45 | diff --git a/tests/qemu-iotests/081 b/tests/qemu-iotests/081 | ||
46 | index XXXXXXX..XXXXXXX 100755 | ||
47 | --- a/tests/qemu-iotests/081 | ||
48 | +++ b/tests/qemu-iotests/081 | ||
49 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
50 | _supported_fmt raw | ||
51 | _supported_proto file | ||
52 | _supported_os Linux | ||
53 | +_require_drivers quorum | ||
54 | |||
55 | do_run_qemu() | ||
56 | { | ||
57 | @@ -XXX,XX +XXX,XX @@ run_qemu() | ||
58 | | _filter_qemu_io | _filter_generated_node_ids | ||
59 | } | ||
60 | |||
61 | -test_quorum=$($QEMU_IMG --help|grep quorum) | ||
62 | -[ "$test_quorum" = "" ] && _supported_fmt quorum | ||
63 | - | ||
64 | quorum="driver=raw,file.driver=quorum,file.vote-threshold=2" | ||
65 | quorum="$quorum,file.children.0.file.filename=$TEST_DIR/1.raw" | ||
66 | quorum="$quorum,file.children.1.file.filename=$TEST_DIR/2.raw" | ||
67 | diff --git a/tests/qemu-iotests/099 b/tests/qemu-iotests/099 | ||
68 | index XXXXXXX..XXXXXXX 100755 | ||
69 | --- a/tests/qemu-iotests/099 | ||
70 | +++ b/tests/qemu-iotests/099 | ||
71 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
72 | _supported_fmt qcow qcow2 qed vdi vhdx vmdk vpc | ||
73 | _supported_proto file | ||
74 | _supported_os Linux | ||
75 | +_require_drivers blkdebug blkverify | ||
76 | _unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" \ | ||
77 | "subformat=twoGbMaxExtentSparse" | ||
78 | |||
79 | diff --git a/tests/qemu-iotests/120 b/tests/qemu-iotests/120 | ||
80 | index XXXXXXX..XXXXXXX 100755 | ||
81 | --- a/tests/qemu-iotests/120 | ||
82 | +++ b/tests/qemu-iotests/120 | ||
83 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
84 | _supported_fmt generic | ||
85 | _supported_proto file | ||
86 | _unsupported_fmt luks | ||
87 | +_require_drivers raw | ||
88 | |||
89 | _make_test_img 64M | ||
90 | |||
91 | diff --git a/tests/qemu-iotests/162 b/tests/qemu-iotests/162 | ||
92 | index XXXXXXX..XXXXXXX 100755 | ||
93 | --- a/tests/qemu-iotests/162 | ||
94 | +++ b/tests/qemu-iotests/162 | ||
95 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
96 | . ./common.filter | ||
97 | |||
98 | _supported_fmt generic | ||
99 | - | ||
100 | -test_ssh=$($QEMU_IMG --help | grep '^Supported formats:.* ssh\( \|$\)') | ||
101 | -[ "$test_ssh" = "" ] && _notrun "ssh support required" | ||
102 | +_require_drivers ssh | ||
103 | |||
104 | echo | ||
105 | echo '=== NBD ===' | ||
106 | diff --git a/tests/qemu-iotests/184 b/tests/qemu-iotests/184 | ||
107 | index XXXXXXX..XXXXXXX 100755 | ||
108 | --- a/tests/qemu-iotests/184 | ||
109 | +++ b/tests/qemu-iotests/184 | ||
110 | @@ -XXX,XX +XXX,XX @@ trap "exit \$status" 0 1 2 3 15 | ||
111 | . ./common.filter | ||
112 | |||
113 | _supported_os Linux | ||
114 | +_require_drivers throttle | ||
115 | |||
116 | do_run_qemu() | ||
117 | { | ||
118 | diff --git a/tests/qemu-iotests/186 b/tests/qemu-iotests/186 | ||
119 | index XXXXXXX..XXXXXXX 100755 | ||
120 | --- a/tests/qemu-iotests/186 | ||
121 | +++ b/tests/qemu-iotests/186 | ||
122 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
123 | |||
124 | _supported_fmt qcow2 | ||
125 | _supported_proto file | ||
126 | +_require_drivers null-co | ||
127 | |||
128 | if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then | ||
129 | _notrun "Requires a PC machine" | ||
130 | diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc | ||
131 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
132 | --- a/tests/qemu-iotests/common.rc | 18 | --- a/tests/Makefile.include |
133 | +++ b/tests/qemu-iotests/common.rc | 19 | +++ b/tests/Makefile.include |
134 | @@ -XXX,XX +XXX,XX @@ _require_command() | 20 | @@ -XXX,XX +XXX,XX @@ QEMU_IOTESTS_HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = tests/qemu |
135 | [ -x "$c" ] || _notrun "$1 utility required, skipped this test" | 21 | check-tests/check-block.sh: tests/check-block.sh qemu-img$(EXESUF) \ |
136 | } | 22 | qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \ |
137 | 23 | $(patsubst %,%/all,$(filter %-softmmu,$(TARGET_DIRS))) | |
138 | +# Check that a set of drivers has been whitelisted in the QEMU binary | 24 | - $< |
139 | +# | 25 | + @$< |
140 | +_require_drivers() | 26 | |
141 | +{ | 27 | .PHONY: $(patsubst %, check-%, $(check-qapi-schema-y)) |
142 | + available=$($QEMU -drive format=help | \ | 28 | $(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/%.json |
143 | + sed -e '/Supported formats:/!d' -e 's/Supported formats://') | ||
144 | + for driver | ||
145 | + do | ||
146 | + if ! echo "$available" | grep -q " $driver\( \|$\)"; then | ||
147 | + _notrun "$driver not available" | ||
148 | + fi | ||
149 | + done | ||
150 | +} | ||
151 | + | ||
152 | # make sure this script returns success | ||
153 | true | ||
154 | -- | 29 | -- |
155 | 2.21.0 | 30 | 2.21.0 |
156 | 31 | ||
157 | 32 | diff view generated by jsdifflib |
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | It's wrong to OR shared permissions. It may lead to crash on further | 3 | qemu-io now prefixes its error and warnings with "qemu-io:". |
4 | permission updates. | 4 | 36b9986b08787019e fixed a lot of iotests output but forget about |
5 | Also, no needs to consider previously calculated permissions, as at | 5 | 026.out.nocache. Fix it too. |
6 | this point we already bind all new parents and bdrv_get_cumulative_perm | ||
7 | result is enough. So fix the bug by just set permissions by | ||
8 | bdrv_get_cumulative_perm result. | ||
9 | 6 | ||
10 | Bug was introduced in long ago 234ac1a9025, in 2.9. | 7 | Fixes: 99e98d7c9fc1a1639fad ("qemu-io: Use error_[gs]et_progname()") |
11 | |||
12 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 8 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
13 | Message-id: 20190824100740.61635-1-vsementsov@virtuozzo.com | 9 | Message-id: 20190816153015.447957-2-vsementsov@virtuozzo.com |
10 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
14 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 11 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
15 | --- | 12 | --- |
16 | block.c | 5 ++--- | 13 | tests/qemu-iotests/026.out.nocache | 168 ++++++++++++++--------------- |
17 | 1 file changed, 2 insertions(+), 3 deletions(-) | 14 | 1 file changed, 84 insertions(+), 84 deletions(-) |
18 | 15 | ||
19 | diff --git a/block.c b/block.c | 16 | diff --git a/tests/qemu-iotests/026.out.nocache b/tests/qemu-iotests/026.out.nocache |
20 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/block.c | 18 | --- a/tests/qemu-iotests/026.out.nocache |
22 | +++ b/block.c | 19 | +++ b/tests/qemu-iotests/026.out.nocache |
23 | @@ -XXX,XX +XXX,XX @@ void bdrv_replace_node(BlockDriverState *from, BlockDriverState *to, | 20 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. |
24 | { | 21 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 |
25 | BdrvChild *c, *next; | 22 | |
26 | GSList *list = NULL, *p; | 23 | Event: l1_update; errno: 5; imm: off; once: off; write |
27 | - uint64_t old_perm, old_shared; | 24 | -Failed to flush the L2 table cache: Input/output error |
28 | uint64_t perm = 0, shared = BLK_PERM_ALL; | 25 | -Failed to flush the refcount block cache: Input/output error |
29 | int ret; | 26 | +qemu-io: Failed to flush the L2 table cache: Input/output error |
30 | 27 | +qemu-io: Failed to flush the refcount block cache: Input/output error | |
31 | @@ -XXX,XX +XXX,XX @@ void bdrv_replace_node(BlockDriverState *from, BlockDriverState *to, | 28 | write failed: Input/output error |
32 | bdrv_unref(from); | 29 | |
33 | } | 30 | 1 leaked clusters were found on the image. |
34 | 31 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | |
35 | - bdrv_get_cumulative_perm(to, &old_perm, &old_shared); | 32 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 |
36 | - bdrv_set_perm(to, old_perm | perm, old_shared | shared); | 33 | |
37 | + bdrv_get_cumulative_perm(to, &perm, &shared); | 34 | Event: l1_update; errno: 5; imm: off; once: off; write -b |
38 | + bdrv_set_perm(to, perm, shared); | 35 | -Failed to flush the L2 table cache: Input/output error |
39 | 36 | -Failed to flush the refcount block cache: Input/output error | |
40 | out: | 37 | +qemu-io: Failed to flush the L2 table cache: Input/output error |
41 | g_slist_free(list); | 38 | +qemu-io: Failed to flush the refcount block cache: Input/output error |
39 | write failed: Input/output error | ||
40 | |||
41 | 1 leaked clusters were found on the image. | ||
42 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
43 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
44 | |||
45 | Event: l1_update; errno: 28; imm: off; once: off; write | ||
46 | -Failed to flush the L2 table cache: No space left on device | ||
47 | -Failed to flush the refcount block cache: No space left on device | ||
48 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
49 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
50 | write failed: No space left on device | ||
51 | |||
52 | 1 leaked clusters were found on the image. | ||
53 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | ||
54 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
55 | |||
56 | Event: l1_update; errno: 28; imm: off; once: off; write -b | ||
57 | -Failed to flush the L2 table cache: No space left on device | ||
58 | -Failed to flush the refcount block cache: No space left on device | ||
59 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
60 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
61 | write failed: No space left on device | ||
62 | |||
63 | 1 leaked clusters were found on the image. | ||
64 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
65 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
66 | |||
67 | Event: l2_update; errno: 5; imm: off; once: off; write | ||
68 | -Failed to flush the L2 table cache: Input/output error | ||
69 | -Failed to flush the refcount block cache: Input/output error | ||
70 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
71 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
72 | wrote 131072/131072 bytes at offset 0 | ||
73 | 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
74 | |||
75 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | ||
76 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
77 | |||
78 | Event: l2_update; errno: 5; imm: off; once: off; write -b | ||
79 | -Failed to flush the L2 table cache: Input/output error | ||
80 | -Failed to flush the refcount block cache: Input/output error | ||
81 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
82 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
83 | wrote 131072/131072 bytes at offset 0 | ||
84 | 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
85 | |||
86 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
87 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
88 | |||
89 | Event: l2_update; errno: 28; imm: off; once: off; write | ||
90 | -Failed to flush the L2 table cache: No space left on device | ||
91 | -Failed to flush the refcount block cache: No space left on device | ||
92 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
93 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
94 | wrote 131072/131072 bytes at offset 0 | ||
95 | 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
96 | |||
97 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | ||
98 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
99 | |||
100 | Event: l2_update; errno: 28; imm: off; once: off; write -b | ||
101 | -Failed to flush the L2 table cache: No space left on device | ||
102 | -Failed to flush the refcount block cache: No space left on device | ||
103 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
104 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
105 | wrote 131072/131072 bytes at offset 0 | ||
106 | 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
107 | |||
108 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
109 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
110 | |||
111 | Event: l2_alloc_write; errno: 5; imm: off; once: off; write | ||
112 | -Failed to flush the L2 table cache: Input/output error | ||
113 | -Failed to flush the refcount block cache: Input/output error | ||
114 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
115 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
116 | write failed: Input/output error | ||
117 | No errors were found on the image. | ||
118 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
119 | |||
120 | Event: l2_alloc_write; errno: 5; imm: off; once: off; write -b | ||
121 | -Failed to flush the L2 table cache: Input/output error | ||
122 | -Failed to flush the refcount block cache: Input/output error | ||
123 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
124 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
125 | write failed: Input/output error | ||
126 | |||
127 | 1 leaked clusters were found on the image. | ||
128 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
129 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
130 | |||
131 | Event: l2_alloc_write; errno: 28; imm: off; once: off; write | ||
132 | -Failed to flush the L2 table cache: No space left on device | ||
133 | -Failed to flush the refcount block cache: No space left on device | ||
134 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
135 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
136 | write failed: No space left on device | ||
137 | No errors were found on the image. | ||
138 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
139 | |||
140 | Event: l2_alloc_write; errno: 28; imm: off; once: off; write -b | ||
141 | -Failed to flush the L2 table cache: No space left on device | ||
142 | -Failed to flush the refcount block cache: No space left on device | ||
143 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
144 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
145 | write failed: No space left on device | ||
146 | |||
147 | 1 leaked clusters were found on the image. | ||
148 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
149 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
150 | |||
151 | Event: write_aio; errno: 5; imm: off; once: off; write | ||
152 | -Failed to flush the L2 table cache: Input/output error | ||
153 | -Failed to flush the refcount block cache: Input/output error | ||
154 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
155 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
156 | write failed: Input/output error | ||
157 | No errors were found on the image. | ||
158 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
159 | |||
160 | Event: write_aio; errno: 5; imm: off; once: off; write -b | ||
161 | -Failed to flush the L2 table cache: Input/output error | ||
162 | -Failed to flush the refcount block cache: Input/output error | ||
163 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
164 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
165 | write failed: Input/output error | ||
166 | No errors were found on the image. | ||
167 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
168 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
169 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
170 | |||
171 | Event: write_aio; errno: 28; imm: off; once: off; write | ||
172 | -Failed to flush the L2 table cache: No space left on device | ||
173 | -Failed to flush the refcount block cache: No space left on device | ||
174 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
175 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
176 | write failed: No space left on device | ||
177 | No errors were found on the image. | ||
178 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
179 | |||
180 | Event: write_aio; errno: 28; imm: off; once: off; write -b | ||
181 | -Failed to flush the L2 table cache: No space left on device | ||
182 | -Failed to flush the refcount block cache: No space left on device | ||
183 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
184 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
185 | write failed: No space left on device | ||
186 | No errors were found on the image. | ||
187 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
188 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
189 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
190 | |||
191 | Event: refblock_load; errno: 5; imm: off; once: off; write | ||
192 | -Failed to flush the L2 table cache: Input/output error | ||
193 | -Failed to flush the refcount block cache: Input/output error | ||
194 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
195 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
196 | write failed: Input/output error | ||
197 | No errors were found on the image. | ||
198 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
199 | |||
200 | Event: refblock_load; errno: 5; imm: off; once: off; write -b | ||
201 | -Failed to flush the L2 table cache: Input/output error | ||
202 | -Failed to flush the refcount block cache: Input/output error | ||
203 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
204 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
205 | write failed: Input/output error | ||
206 | No errors were found on the image. | ||
207 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
208 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
209 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
210 | |||
211 | Event: refblock_load; errno: 28; imm: off; once: off; write | ||
212 | -Failed to flush the L2 table cache: No space left on device | ||
213 | -Failed to flush the refcount block cache: No space left on device | ||
214 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
215 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
216 | write failed: No space left on device | ||
217 | No errors were found on the image. | ||
218 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
219 | |||
220 | Event: refblock_load; errno: 28; imm: off; once: off; write -b | ||
221 | -Failed to flush the L2 table cache: No space left on device | ||
222 | -Failed to flush the refcount block cache: No space left on device | ||
223 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
224 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
225 | write failed: No space left on device | ||
226 | No errors were found on the image. | ||
227 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
228 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
229 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
230 | |||
231 | Event: refblock_update_part; errno: 5; imm: off; once: off; write | ||
232 | -Failed to flush the L2 table cache: Input/output error | ||
233 | -Failed to flush the refcount block cache: Input/output error | ||
234 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
235 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
236 | write failed: Input/output error | ||
237 | No errors were found on the image. | ||
238 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
239 | |||
240 | Event: refblock_update_part; errno: 5; imm: off; once: off; write -b | ||
241 | -Failed to flush the L2 table cache: Input/output error | ||
242 | -Failed to flush the refcount block cache: Input/output error | ||
243 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
244 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
245 | write failed: Input/output error | ||
246 | No errors were found on the image. | ||
247 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
248 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
249 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
250 | |||
251 | Event: refblock_update_part; errno: 28; imm: off; once: off; write | ||
252 | -Failed to flush the L2 table cache: No space left on device | ||
253 | -Failed to flush the refcount block cache: No space left on device | ||
254 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
255 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
256 | write failed: No space left on device | ||
257 | No errors were found on the image. | ||
258 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
259 | |||
260 | Event: refblock_update_part; errno: 28; imm: off; once: off; write -b | ||
261 | -Failed to flush the L2 table cache: No space left on device | ||
262 | -Failed to flush the refcount block cache: No space left on device | ||
263 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
264 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
265 | write failed: No space left on device | ||
266 | No errors were found on the image. | ||
267 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
268 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
269 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
270 | |||
271 | Event: refblock_alloc; errno: 5; imm: off; once: off; write | ||
272 | -Failed to flush the L2 table cache: Input/output error | ||
273 | -Failed to flush the refcount block cache: Input/output error | ||
274 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
275 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
276 | write failed: Input/output error | ||
277 | No errors were found on the image. | ||
278 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
279 | |||
280 | Event: refblock_alloc; errno: 5; imm: off; once: off; write -b | ||
281 | -Failed to flush the L2 table cache: Input/output error | ||
282 | -Failed to flush the refcount block cache: Input/output error | ||
283 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
284 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
285 | write failed: Input/output error | ||
286 | No errors were found on the image. | ||
287 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
288 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
289 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
290 | |||
291 | Event: refblock_alloc; errno: 28; imm: off; once: off; write | ||
292 | -Failed to flush the L2 table cache: No space left on device | ||
293 | -Failed to flush the refcount block cache: No space left on device | ||
294 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
295 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
296 | write failed: No space left on device | ||
297 | No errors were found on the image. | ||
298 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
299 | |||
300 | Event: refblock_alloc; errno: 28; imm: off; once: off; write -b | ||
301 | -Failed to flush the L2 table cache: No space left on device | ||
302 | -Failed to flush the refcount block cache: No space left on device | ||
303 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
304 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
305 | write failed: No space left on device | ||
306 | No errors were found on the image. | ||
307 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
308 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
309 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
310 | |||
311 | Event: refblock_alloc_hookup; errno: 28; imm: off; once: off; write | ||
312 | -Failed to flush the L2 table cache: No space left on device | ||
313 | -Failed to flush the refcount block cache: No space left on device | ||
314 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
315 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
316 | write failed: No space left on device | ||
317 | |||
318 | 55 leaked clusters were found on the image. | ||
319 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | ||
320 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
321 | |||
322 | Event: refblock_alloc_hookup; errno: 28; imm: off; once: off; write -b | ||
323 | -Failed to flush the L2 table cache: No space left on device | ||
324 | -Failed to flush the refcount block cache: No space left on device | ||
325 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
326 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
327 | write failed: No space left on device | ||
328 | |||
329 | 251 leaked clusters were found on the image. | ||
330 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
331 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
332 | |||
333 | Event: refblock_alloc_write; errno: 28; imm: off; once: off; write | ||
334 | -Failed to flush the L2 table cache: No space left on device | ||
335 | -Failed to flush the refcount block cache: No space left on device | ||
336 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
337 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
338 | write failed: No space left on device | ||
339 | No errors were found on the image. | ||
340 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
341 | |||
342 | Event: refblock_alloc_write; errno: 28; imm: off; once: off; write -b | ||
343 | -Failed to flush the L2 table cache: No space left on device | ||
344 | -Failed to flush the refcount block cache: No space left on device | ||
345 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
346 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
347 | write failed: No space left on device | ||
348 | No errors were found on the image. | ||
349 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
350 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
351 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
352 | |||
353 | Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: off; write | ||
354 | -Failed to flush the L2 table cache: No space left on device | ||
355 | -Failed to flush the refcount block cache: No space left on device | ||
356 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
357 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
358 | write failed: No space left on device | ||
359 | |||
360 | 10 leaked clusters were found on the image. | ||
361 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | ||
362 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
363 | |||
364 | Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: off; write -b | ||
365 | -Failed to flush the L2 table cache: No space left on device | ||
366 | -Failed to flush the refcount block cache: No space left on device | ||
367 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
368 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
369 | write failed: No space left on device | ||
370 | |||
371 | 23 leaked clusters were found on the image. | ||
372 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
373 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
374 | |||
375 | Event: refblock_alloc_write_table; errno: 28; imm: off; once: off; write | ||
376 | -Failed to flush the L2 table cache: No space left on device | ||
377 | -Failed to flush the refcount block cache: No space left on device | ||
378 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
379 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
380 | write failed: No space left on device | ||
381 | |||
382 | 10 leaked clusters were found on the image. | ||
383 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | ||
384 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
385 | |||
386 | Event: refblock_alloc_write_table; errno: 28; imm: off; once: off; write -b | ||
387 | -Failed to flush the L2 table cache: No space left on device | ||
388 | -Failed to flush the refcount block cache: No space left on device | ||
389 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
390 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
391 | write failed: No space left on device | ||
392 | |||
393 | 23 leaked clusters were found on the image. | ||
394 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
395 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
396 | |||
397 | Event: refblock_alloc_switch_table; errno: 28; imm: off; once: off; write | ||
398 | -Failed to flush the L2 table cache: No space left on device | ||
399 | -Failed to flush the refcount block cache: No space left on device | ||
400 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
401 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
402 | write failed: No space left on device | ||
403 | |||
404 | 10 leaked clusters were found on the image. | ||
405 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | ||
406 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
407 | |||
408 | Event: refblock_alloc_switch_table; errno: 28; imm: off; once: off; write -b | ||
409 | -Failed to flush the L2 table cache: No space left on device | ||
410 | -Failed to flush the refcount block cache: No space left on device | ||
411 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
412 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
413 | write failed: No space left on device | ||
414 | |||
415 | 23 leaked clusters were found on the image. | ||
416 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
417 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
418 | |||
419 | Event: l1_grow_write_table; errno: 5; imm: off; once: off | ||
420 | -Failed to flush the L2 table cache: Input/output error | ||
421 | -Failed to flush the refcount block cache: Input/output error | ||
422 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
423 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
424 | write failed: Input/output error | ||
425 | No errors were found on the image. | ||
426 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
427 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
428 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
429 | |||
430 | Event: l1_grow_write_table; errno: 28; imm: off; once: off | ||
431 | -Failed to flush the L2 table cache: No space left on device | ||
432 | -Failed to flush the refcount block cache: No space left on device | ||
433 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
434 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
435 | write failed: No space left on device | ||
436 | No errors were found on the image. | ||
437 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
438 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
439 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
440 | |||
441 | Event: l1_grow_activate_table; errno: 5; imm: off; once: off | ||
442 | -Failed to flush the L2 table cache: Input/output error | ||
443 | -Failed to flush the refcount block cache: Input/output error | ||
444 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
445 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
446 | write failed: Input/output error | ||
447 | |||
448 | 96 leaked clusters were found on the image. | ||
449 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
450 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
451 | |||
452 | Event: l1_grow_activate_table; errno: 28; imm: off; once: off | ||
453 | -Failed to flush the L2 table cache: No space left on device | ||
454 | -Failed to flush the refcount block cache: No space left on device | ||
455 | +qemu-io: Failed to flush the L2 table cache: No space left on device | ||
456 | +qemu-io: Failed to flush the refcount block cache: No space left on device | ||
457 | write failed: No space left on device | ||
458 | |||
459 | 96 leaked clusters were found on the image. | ||
42 | -- | 460 | -- |
43 | 2.21.0 | 461 | 2.21.0 |
44 | 462 | ||
45 | 463 | diff view generated by jsdifflib |
1 | We had a test for a case where relative extent paths did not work, but | 1 | A follow-up patch will make curl_multi_do() and curl_multi_read() take a |
---|---|---|---|
2 | unfortunately we just fixed the underlying problem, so it works now. | 2 | CURLSocket instead of the CURLState. They still need the latter, |
3 | This patch adds a new test case that still fails. | 3 | though, so add a pointer to it to the former. |
4 | 4 | ||
5 | Cc: qemu-stable@nongnu.org | ||
5 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 6 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
6 | Reviewed-by: John Snow <jsnow@redhat.com> | 7 | Reviewed-by: John Snow <jsnow@redhat.com> |
7 | Message-id: 20190815153638.4600-4-mreitz@redhat.com | 8 | Message-id: 20190910124136.10565-2-mreitz@redhat.com |
8 | Reviewed-by: John Snow <jsnow@redhat.com> | 9 | Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> |
9 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 10 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
10 | --- | 11 | --- |
11 | tests/qemu-iotests/059 | 27 +++++++++++++++++++++++++++ | 12 | block/curl.c | 3 +++ |
12 | tests/qemu-iotests/059.out | 4 ++++ | 13 | 1 file changed, 3 insertions(+) |
13 | 2 files changed, 31 insertions(+) | ||
14 | 14 | ||
15 | diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059 | 15 | diff --git a/block/curl.c b/block/curl.c |
16 | index XXXXXXX..XXXXXXX 100755 | ||
17 | --- a/tests/qemu-iotests/059 | ||
18 | +++ b/tests/qemu-iotests/059 | ||
19 | @@ -XXX,XX +XXX,XX @@ $QEMU_IMG convert -f qcow2 -O vmdk -o subformat=streamOptimized "$TEST_IMG.qcow2 | ||
20 | |||
21 | echo | ||
22 | echo "=== Testing monolithicFlat with internally generated JSON file name ===" | ||
23 | + | ||
24 | +echo '--- blkdebug ---' | ||
25 | # Should work, because bdrv_dirname() works fine with blkdebug | ||
26 | IMGOPTS="subformat=monolithicFlat" _make_test_img 64M | ||
27 | $QEMU_IO -c "open -o driver=$IMGFMT,file.driver=blkdebug,file.image.filename=$TEST_IMG,file.inject-error.0.event=read_aio" \ | ||
28 | @@ -XXX,XX +XXX,XX @@ $QEMU_IO -c "open -o driver=$IMGFMT,file.driver=blkdebug,file.image.filename=$TE | ||
29 | | _filter_testdir | _filter_imgfmt | _filter_img_info | ||
30 | _cleanup_test_img | ||
31 | |||
32 | +echo '--- quorum ---' | ||
33 | +# Should not work, because bdrv_dirname() does not work with quorum | ||
34 | +IMGOPTS="subformat=monolithicFlat" _make_test_img 64M | ||
35 | +cp "$TEST_IMG" "$TEST_IMG.orig" | ||
36 | + | ||
37 | +filename="json:{ | ||
38 | + \"driver\": \"$IMGFMT\", | ||
39 | + \"file\": { | ||
40 | + \"driver\": \"quorum\", | ||
41 | + \"children\": [ { | ||
42 | + \"driver\": \"file\", | ||
43 | + \"filename\": \"$TEST_IMG\" | ||
44 | + }, { | ||
45 | + \"driver\": \"file\", | ||
46 | + \"filename\": \"$TEST_IMG.orig\" | ||
47 | + } ], | ||
48 | + \"vote-threshold\": 1 | ||
49 | + } }" | ||
50 | + | ||
51 | +filename=$(echo "$filename" | tr '\n' ' ' | sed -e 's/\s\+/ /g') | ||
52 | +$QEMU_IMG info "$filename" 2>&1 \ | ||
53 | + | sed -e "s/'json:[^']*'/\$QUORUM_FILE/g" \ | ||
54 | + | _filter_testdir | _filter_imgfmt | _filter_img_info | ||
55 | + | ||
56 | + | ||
57 | echo | ||
58 | echo "=== Testing version 3 ===" | ||
59 | _use_sample_img iotest-version3.vmdk.bz2 | ||
60 | diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out | ||
61 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
62 | --- a/tests/qemu-iotests/059.out | 17 | --- a/block/curl.c |
63 | +++ b/tests/qemu-iotests/059.out | 18 | +++ b/block/curl.c |
64 | @@ -XXX,XX +XXX,XX @@ wrote 512/512 bytes at offset 10240 | 19 | @@ -XXX,XX +XXX,XX @@ static CURLMcode __curl_multi_socket_action(CURLM *multi_handle, |
65 | 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | 20 | #define CURL_BLOCK_OPT_TIMEOUT_DEFAULT 5 |
66 | 21 | ||
67 | === Testing monolithicFlat with internally generated JSON file name === | 22 | struct BDRVCURLState; |
68 | +--- blkdebug --- | 23 | +struct CURLState; |
69 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | 24 | |
70 | format name: IMGFMT | 25 | static bool libcurl_initialized; |
71 | cluster size: 0 bytes | 26 | |
72 | vm state offset: 0 bytes | 27 | @@ -XXX,XX +XXX,XX @@ typedef struct CURLAIOCB { |
73 | +--- quorum --- | 28 | |
74 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | 29 | typedef struct CURLSocket { |
75 | +qemu-img: Could not open $QUORUM_FILE: Cannot use relative paths with VMDK descriptor file $QUORUM_FILE: Cannot generate a base directory for quorum nodes | 30 | int fd; |
76 | 31 | + struct CURLState *state; | |
77 | === Testing version 3 === | 32 | QLIST_ENTRY(CURLSocket) next; |
78 | image: TEST_DIR/iotest-version3.IMGFMT | 33 | } CURLSocket; |
34 | |||
35 | @@ -XXX,XX +XXX,XX @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action, | ||
36 | if (!socket) { | ||
37 | socket = g_new0(CURLSocket, 1); | ||
38 | socket->fd = fd; | ||
39 | + socket->state = state; | ||
40 | QLIST_INSERT_HEAD(&state->sockets, socket, next); | ||
41 | } | ||
42 | socket = NULL; | ||
79 | -- | 43 | -- |
80 | 2.21.0 | 44 | 2.21.0 |
81 | 45 | ||
82 | 46 | diff view generated by jsdifflib |
1 | The error message for the test case where we have a quorum node for | 1 | This does not really change anything, but it makes the code a bit easier |
---|---|---|---|
2 | which no directory name can be generated is different: For | 2 | to follow once we use @socket as the opaque pointer for |
3 | twoGbMaxExtentSparse, it complains that it cannot open the extent file. | 3 | aio_set_fd_handler(). |
4 | For other (sub)formats, it just notes that it cannot determine the | ||
5 | backing file path. Both are fine, but just disable twoGbMaxExtentSparse | ||
6 | for simplicity's sake. | ||
7 | 4 | ||
5 | Cc: qemu-stable@nongnu.org | ||
8 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 6 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
9 | Reviewed-by: John Snow <jsnow@redhat.com> | 7 | Message-id: 20190910124136.10565-3-mreitz@redhat.com |
10 | Message-id: 20190815153638.4600-7-mreitz@redhat.com | 8 | Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> |
11 | Reviewed-by: John Snow <jsnow@redhat.com> | 9 | Reviewed-by: John Snow <jsnow@redhat.com> |
12 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 10 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
13 | --- | 11 | --- |
14 | tests/qemu-iotests/110 | 3 ++- | 12 | block/curl.c | 10 +++++----- |
15 | 1 file changed, 2 insertions(+), 1 deletion(-) | 13 | 1 file changed, 5 insertions(+), 5 deletions(-) |
16 | 14 | ||
17 | diff --git a/tests/qemu-iotests/110 b/tests/qemu-iotests/110 | 15 | diff --git a/block/curl.c b/block/curl.c |
18 | index XXXXXXX..XXXXXXX 100755 | 16 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/tests/qemu-iotests/110 | 17 | --- a/block/curl.c |
20 | +++ b/tests/qemu-iotests/110 | 18 | +++ b/block/curl.c |
21 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | 19 | @@ -XXX,XX +XXX,XX @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action, |
22 | # Any format supporting backing files | 20 | |
23 | _supported_fmt qed qcow qcow2 vmdk | 21 | QLIST_FOREACH(socket, &state->sockets, next) { |
24 | _supported_proto file | 22 | if (socket->fd == fd) { |
25 | -_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" | 23 | - if (action == CURL_POLL_REMOVE) { |
26 | +_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" \ | 24 | - QLIST_REMOVE(socket, next); |
27 | + "subformat=twoGbMaxExtentSparse" | 25 | - g_free(socket); |
28 | 26 | - } | |
29 | TEST_IMG_REL=$(basename "$TEST_IMG") | 27 | break; |
28 | } | ||
29 | } | ||
30 | @@ -XXX,XX +XXX,XX @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action, | ||
31 | socket->state = state; | ||
32 | QLIST_INSERT_HEAD(&state->sockets, socket, next); | ||
33 | } | ||
34 | - socket = NULL; | ||
35 | |||
36 | trace_curl_sock_cb(action, (int)fd); | ||
37 | switch (action) { | ||
38 | @@ -XXX,XX +XXX,XX @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action, | ||
39 | break; | ||
40 | } | ||
41 | |||
42 | + if (action == CURL_POLL_REMOVE) { | ||
43 | + QLIST_REMOVE(socket, next); | ||
44 | + g_free(socket); | ||
45 | + } | ||
46 | + | ||
47 | return 0; | ||
48 | } | ||
30 | 49 | ||
31 | -- | 50 | -- |
32 | 2.21.0 | 51 | 2.21.0 |
33 | 52 | ||
34 | 53 | diff view generated by jsdifflib |
1 | iotest 126 requires backing file support, which flat vmdks cannot offer. | 1 | While it is more likely that transfers complete after some file |
---|---|---|---|
2 | Skip this test for such subformats. | 2 | descriptor has data ready to read, we probably should not rely on it. |
3 | Better be safe than sorry and call curl_multi_check_completion() in | ||
4 | curl_multi_do(), too, just like it is done in curl_multi_read(). | ||
5 | |||
6 | With this change, curl_multi_do() and curl_multi_read() are actually the | ||
7 | same, so drop curl_multi_read() and use curl_multi_do() as the sole FD | ||
8 | handler. | ||
3 | 9 | ||
4 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 10 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
5 | Message-id: 20190815153638.4600-8-mreitz@redhat.com | 11 | Message-id: 20190910124136.10565-4-mreitz@redhat.com |
12 | Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> | ||
6 | Reviewed-by: John Snow <jsnow@redhat.com> | 13 | Reviewed-by: John Snow <jsnow@redhat.com> |
7 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 14 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
8 | --- | 15 | --- |
9 | tests/qemu-iotests/126 | 2 ++ | 16 | block/curl.c | 14 ++------------ |
10 | 1 file changed, 2 insertions(+) | 17 | 1 file changed, 2 insertions(+), 12 deletions(-) |
11 | 18 | ||
12 | diff --git a/tests/qemu-iotests/126 b/tests/qemu-iotests/126 | 19 | diff --git a/block/curl.c b/block/curl.c |
13 | index XXXXXXX..XXXXXXX 100755 | 20 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/tests/qemu-iotests/126 | 21 | --- a/block/curl.c |
15 | +++ b/tests/qemu-iotests/126 | 22 | +++ b/block/curl.c |
16 | @@ -XXX,XX +XXX,XX @@ status=1 # failure is the default! | 23 | @@ -XXX,XX +XXX,XX @@ typedef struct BDRVCURLState { |
17 | 24 | ||
18 | # Needs backing file support | 25 | static void curl_clean_state(CURLState *s); |
19 | _supported_fmt qcow qcow2 qed vmdk | 26 | static void curl_multi_do(void *arg); |
20 | +_unsupported_imgopts "subformat=monolithicFlat" \ | 27 | -static void curl_multi_read(void *arg); |
21 | + "subformat=twoGbMaxExtentFlat" | 28 | |
22 | # This is the default protocol (and we want to test the difference between | 29 | #ifdef NEED_CURL_TIMER_CALLBACK |
23 | # colons which separate a protocol prefix from the rest and colons which are | 30 | /* Called from curl_multi_do_locked, with s->mutex held. */ |
24 | # just part of the filename, so we cannot test protocols which require a prefix) | 31 | @@ -XXX,XX +XXX,XX @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action, |
32 | switch (action) { | ||
33 | case CURL_POLL_IN: | ||
34 | aio_set_fd_handler(s->aio_context, fd, false, | ||
35 | - curl_multi_read, NULL, NULL, state); | ||
36 | + curl_multi_do, NULL, NULL, state); | ||
37 | break; | ||
38 | case CURL_POLL_OUT: | ||
39 | aio_set_fd_handler(s->aio_context, fd, false, | ||
40 | @@ -XXX,XX +XXX,XX @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action, | ||
41 | break; | ||
42 | case CURL_POLL_INOUT: | ||
43 | aio_set_fd_handler(s->aio_context, fd, false, | ||
44 | - curl_multi_read, curl_multi_do, NULL, state); | ||
45 | + curl_multi_do, curl_multi_do, NULL, state); | ||
46 | break; | ||
47 | case CURL_POLL_REMOVE: | ||
48 | aio_set_fd_handler(s->aio_context, fd, false, | ||
49 | @@ -XXX,XX +XXX,XX @@ static void curl_multi_do(void *arg) | ||
50 | { | ||
51 | CURLState *s = (CURLState *)arg; | ||
52 | |||
53 | - qemu_mutex_lock(&s->s->mutex); | ||
54 | - curl_multi_do_locked(s); | ||
55 | - qemu_mutex_unlock(&s->s->mutex); | ||
56 | -} | ||
57 | - | ||
58 | -static void curl_multi_read(void *arg) | ||
59 | -{ | ||
60 | - CURLState *s = (CURLState *)arg; | ||
61 | - | ||
62 | qemu_mutex_lock(&s->s->mutex); | ||
63 | curl_multi_do_locked(s); | ||
64 | curl_multi_check_completion(s->s); | ||
25 | -- | 65 | -- |
26 | 2.21.0 | 66 | 2.21.0 |
27 | 67 | ||
28 | 68 | diff view generated by jsdifflib |
1 | This makes iotest 033 pass with e.g. subformat=monolithicFlat. It also | 1 | curl_multi_do_locked() currently marks all sockets as ready. That is |
---|---|---|---|
2 | turns a former error in 059 into success. | 2 | not only inefficient, but in fact unsafe (the loop is). A follow-up |
3 | patch will change that, but to do so, curl_multi_do_locked() needs to | ||
4 | know exactly which socket is ready; and that is accomplished by this | ||
5 | patch here. | ||
3 | 6 | ||
7 | Cc: qemu-stable@nongnu.org | ||
4 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 8 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
5 | Message-id: 20190815153638.4600-3-mreitz@redhat.com | 9 | Message-id: 20190910124136.10565-5-mreitz@redhat.com |
10 | Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> | ||
6 | Reviewed-by: John Snow <jsnow@redhat.com> | 11 | Reviewed-by: John Snow <jsnow@redhat.com> |
7 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 12 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
8 | --- | 13 | --- |
9 | block/vmdk.c | 54 ++++++++++++++++++++++++-------------- | 14 | block/curl.c | 20 +++++++++++--------- |
10 | tests/qemu-iotests/059 | 7 +++-- | 15 | 1 file changed, 11 insertions(+), 9 deletions(-) |
11 | tests/qemu-iotests/059.out | 4 ++- | ||
12 | 3 files changed, 42 insertions(+), 23 deletions(-) | ||
13 | 16 | ||
14 | diff --git a/block/vmdk.c b/block/vmdk.c | 17 | diff --git a/block/curl.c b/block/curl.c |
15 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/block/vmdk.c | 19 | --- a/block/curl.c |
17 | +++ b/block/vmdk.c | 20 | +++ b/block/curl.c |
18 | @@ -XXX,XX +XXX,XX @@ static const char *next_line(const char *s) | 21 | @@ -XXX,XX +XXX,XX @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action, |
22 | switch (action) { | ||
23 | case CURL_POLL_IN: | ||
24 | aio_set_fd_handler(s->aio_context, fd, false, | ||
25 | - curl_multi_do, NULL, NULL, state); | ||
26 | + curl_multi_do, NULL, NULL, socket); | ||
27 | break; | ||
28 | case CURL_POLL_OUT: | ||
29 | aio_set_fd_handler(s->aio_context, fd, false, | ||
30 | - NULL, curl_multi_do, NULL, state); | ||
31 | + NULL, curl_multi_do, NULL, socket); | ||
32 | break; | ||
33 | case CURL_POLL_INOUT: | ||
34 | aio_set_fd_handler(s->aio_context, fd, false, | ||
35 | - curl_multi_do, curl_multi_do, NULL, state); | ||
36 | + curl_multi_do, curl_multi_do, NULL, socket); | ||
37 | break; | ||
38 | case CURL_POLL_REMOVE: | ||
39 | aio_set_fd_handler(s->aio_context, fd, false, | ||
40 | @@ -XXX,XX +XXX,XX @@ static void curl_multi_check_completion(BDRVCURLState *s) | ||
19 | } | 41 | } |
20 | 42 | ||
21 | static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, | 43 | /* Called with s->mutex held. */ |
22 | - const char *desc_file_path, QDict *options, | 44 | -static void curl_multi_do_locked(CURLState *s) |
23 | - Error **errp) | 45 | +static void curl_multi_do_locked(CURLSocket *ready_socket) |
24 | + QDict *options, Error **errp) | ||
25 | { | 46 | { |
26 | int ret; | 47 | CURLSocket *socket, *next_socket; |
27 | int matches; | 48 | + CURLState *s = ready_socket->state; |
28 | @@ -XXX,XX +XXX,XX @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, | 49 | int running; |
29 | const char *p, *np; | 50 | int r; |
30 | int64_t sectors = 0; | 51 | |
31 | int64_t flat_offset; | 52 | @@ -XXX,XX +XXX,XX @@ static void curl_multi_do_locked(CURLState *s) |
32 | + char *desc_file_dir = NULL; | 53 | |
33 | char *extent_path; | 54 | static void curl_multi_do(void *arg) |
34 | BdrvChild *extent_file; | 55 | { |
35 | BDRVVmdkState *s = bs->opaque; | 56 | - CURLState *s = (CURLState *)arg; |
36 | @@ -XXX,XX +XXX,XX @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, | 57 | + CURLSocket *socket = arg; |
37 | continue; | 58 | + BDRVCURLState *s = socket->state->s; |
38 | } | 59 | |
39 | 60 | - qemu_mutex_lock(&s->s->mutex); | |
40 | - if (!path_is_absolute(fname) && !path_has_protocol(fname) && | 61 | - curl_multi_do_locked(s); |
41 | - !desc_file_path[0]) | 62 | - curl_multi_check_completion(s->s); |
42 | - { | 63 | - qemu_mutex_unlock(&s->s->mutex); |
43 | - bdrv_refresh_filename(bs->file->bs); | 64 | + qemu_mutex_lock(&s->mutex); |
44 | - error_setg(errp, "Cannot use relative extent paths with VMDK " | 65 | + curl_multi_do_locked(socket); |
45 | - "descriptor file '%s'", bs->file->bs->filename); | 66 | + curl_multi_check_completion(s); |
46 | - return -EINVAL; | 67 | + qemu_mutex_unlock(&s->mutex); |
47 | - } | ||
48 | + if (path_is_absolute(fname)) { | ||
49 | + extent_path = g_strdup(fname); | ||
50 | + } else { | ||
51 | + if (!desc_file_dir) { | ||
52 | + desc_file_dir = bdrv_dirname(bs->file->bs, errp); | ||
53 | + if (!desc_file_dir) { | ||
54 | + bdrv_refresh_filename(bs->file->bs); | ||
55 | + error_prepend(errp, "Cannot use relative paths with VMDK " | ||
56 | + "descriptor file '%s': ", | ||
57 | + bs->file->bs->filename); | ||
58 | + ret = -EINVAL; | ||
59 | + goto out; | ||
60 | + } | ||
61 | + } | ||
62 | |||
63 | - extent_path = path_combine(desc_file_path, fname); | ||
64 | + extent_path = g_strconcat(desc_file_dir, fname, NULL); | ||
65 | + } | ||
66 | |||
67 | ret = snprintf(extent_opt_prefix, 32, "extents.%d", s->num_extents); | ||
68 | assert(ret < 32); | ||
69 | @@ -XXX,XX +XXX,XX @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, | ||
70 | g_free(extent_path); | ||
71 | if (local_err) { | ||
72 | error_propagate(errp, local_err); | ||
73 | - return -EINVAL; | ||
74 | + ret = -EINVAL; | ||
75 | + goto out; | ||
76 | } | ||
77 | |||
78 | /* save to extents array */ | ||
79 | @@ -XXX,XX +XXX,XX @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, | ||
80 | 0, 0, 0, 0, 0, &extent, errp); | ||
81 | if (ret < 0) { | ||
82 | bdrv_unref_child(bs, extent_file); | ||
83 | - return ret; | ||
84 | + goto out; | ||
85 | } | ||
86 | extent->flat_start_offset = flat_offset << 9; | ||
87 | } else if (!strcmp(type, "SPARSE") || !strcmp(type, "VMFSSPARSE")) { | ||
88 | @@ -XXX,XX +XXX,XX @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, | ||
89 | g_free(buf); | ||
90 | if (ret) { | ||
91 | bdrv_unref_child(bs, extent_file); | ||
92 | - return ret; | ||
93 | + goto out; | ||
94 | } | ||
95 | extent = &s->extents[s->num_extents - 1]; | ||
96 | } else if (!strcmp(type, "SESPARSE")) { | ||
97 | ret = vmdk_open_se_sparse(bs, extent_file, bs->open_flags, errp); | ||
98 | if (ret) { | ||
99 | bdrv_unref_child(bs, extent_file); | ||
100 | - return ret; | ||
101 | + goto out; | ||
102 | } | ||
103 | extent = &s->extents[s->num_extents - 1]; | ||
104 | } else { | ||
105 | error_setg(errp, "Unsupported extent type '%s'", type); | ||
106 | bdrv_unref_child(bs, extent_file); | ||
107 | - return -ENOTSUP; | ||
108 | + ret = -ENOTSUP; | ||
109 | + goto out; | ||
110 | } | ||
111 | extent->type = g_strdup(type); | ||
112 | } | ||
113 | - return 0; | ||
114 | + | ||
115 | + ret = 0; | ||
116 | + goto out; | ||
117 | |||
118 | invalid: | ||
119 | np = next_line(p); | ||
120 | @@ -XXX,XX +XXX,XX @@ invalid: | ||
121 | np--; | ||
122 | } | ||
123 | error_setg(errp, "Invalid extent line: %.*s", (int)(np - p), p); | ||
124 | - return -EINVAL; | ||
125 | + ret = -EINVAL; | ||
126 | + | ||
127 | +out: | ||
128 | + g_free(desc_file_dir); | ||
129 | + return ret; | ||
130 | } | 68 | } |
131 | 69 | ||
132 | static int vmdk_open_desc_file(BlockDriverState *bs, int flags, char *buf, | 70 | static void curl_multi_timeout_do(void *arg) |
133 | @@ -XXX,XX +XXX,XX @@ static int vmdk_open_desc_file(BlockDriverState *bs, int flags, char *buf, | ||
134 | } | ||
135 | s->create_type = g_strdup(ct); | ||
136 | s->desc_offset = 0; | ||
137 | - ret = vmdk_parse_extents(buf, bs, bs->file->bs->exact_filename, options, | ||
138 | - errp); | ||
139 | + ret = vmdk_parse_extents(buf, bs, options, errp); | ||
140 | exit: | ||
141 | return ret; | ||
142 | } | ||
143 | diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059 | ||
144 | index XXXXXXX..XXXXXXX 100755 | ||
145 | --- a/tests/qemu-iotests/059 | ||
146 | +++ b/tests/qemu-iotests/059 | ||
147 | @@ -XXX,XX +XXX,XX @@ $QEMU_IMG convert -f qcow2 -O vmdk -o subformat=streamOptimized "$TEST_IMG.qcow2 | ||
148 | |||
149 | echo | ||
150 | echo "=== Testing monolithicFlat with internally generated JSON file name ===" | ||
151 | +# Should work, because bdrv_dirname() works fine with blkdebug | ||
152 | IMGOPTS="subformat=monolithicFlat" _make_test_img 64M | ||
153 | -$QEMU_IO -c "open -o driver=$IMGFMT,file.driver=blkdebug,file.image.filename=$TEST_IMG,file.inject-error.0.event=read_aio" 2>&1 \ | ||
154 | - | _filter_testdir | _filter_imgfmt | ||
155 | +$QEMU_IO -c "open -o driver=$IMGFMT,file.driver=blkdebug,file.image.filename=$TEST_IMG,file.inject-error.0.event=read_aio" \ | ||
156 | + -c info \ | ||
157 | + 2>&1 \ | ||
158 | + | _filter_testdir | _filter_imgfmt | _filter_img_info | ||
159 | _cleanup_test_img | ||
160 | |||
161 | echo | ||
162 | diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out | ||
163 | index XXXXXXX..XXXXXXX 100644 | ||
164 | --- a/tests/qemu-iotests/059.out | ||
165 | +++ b/tests/qemu-iotests/059.out | ||
166 | @@ -XXX,XX +XXX,XX @@ wrote 512/512 bytes at offset 10240 | ||
167 | |||
168 | === Testing monolithicFlat with internally generated JSON file name === | ||
169 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
170 | -qemu-io: can't open: Cannot use relative extent paths with VMDK descriptor file 'json:{"image": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, "driver": "blkdebug", "inject-error.0.event": "read_aio"}' | ||
171 | +format name: IMGFMT | ||
172 | +cluster size: 0 bytes | ||
173 | +vm state offset: 0 bytes | ||
174 | |||
175 | === Testing version 3 === | ||
176 | image: TEST_DIR/iotest-version3.IMGFMT | ||
177 | -- | 71 | -- |
178 | 2.21.0 | 72 | 2.21.0 |
179 | 73 | ||
180 | 74 | diff view generated by jsdifflib |
1 | From: Denis Plotnikov <dplotnikov@virtuozzo.com> | 1 | Instead of reporting all sockets to cURL, only report the one that has |
---|---|---|---|
2 | caused curl_multi_do_locked() to be called. This lets us get rid of the | ||
3 | QLIST_FOREACH_SAFE() list, which was actually wrong: SAFE foreaches are | ||
4 | only safe when the current element is removed in each iteration. If it | ||
5 | possible for the list to be concurrently modified, we cannot guarantee | ||
6 | that only the current element will be removed. Therefore, we must not | ||
7 | use QLIST_FOREACH_SAFE() here. | ||
2 | 8 | ||
3 | The patch allows to provide a pattern file for write | 9 | Fixes: ff5ca1664af85b24a4180d595ea6873fd3deac57 |
4 | command. There was no similar ability before. | 10 | Cc: qemu-stable@nongnu.org |
5 | 11 | Signed-off-by: Max Reitz <mreitz@redhat.com> | |
6 | Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com> | 12 | Message-id: 20190910124136.10565-6-mreitz@redhat.com |
7 | Message-id: 20190820164616.4072-1-dplotnikov@virtuozzo.com | 13 | Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> |
8 | Reviewed-by: Eric Blake <eblake@redhat.com> | 14 | Reviewed-by: John Snow <jsnow@redhat.com> |
9 | [mreitz: Keep optstring in alphabetical order] | ||
10 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 15 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
11 | --- | 16 | --- |
12 | qemu-io-cmds.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++--- | 17 | block/curl.c | 17 ++++++----------- |
13 | 1 file changed, 93 insertions(+), 6 deletions(-) | 18 | 1 file changed, 6 insertions(+), 11 deletions(-) |
14 | 19 | ||
15 | diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c | 20 | diff --git a/block/curl.c b/block/curl.c |
16 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/qemu-io-cmds.c | 22 | --- a/block/curl.c |
18 | +++ b/qemu-io-cmds.c | 23 | +++ b/block/curl.c |
19 | @@ -XXX,XX +XXX,XX @@ static void qemu_io_free(void *p) | 24 | @@ -XXX,XX +XXX,XX @@ static void curl_multi_check_completion(BDRVCURLState *s) |
20 | qemu_vfree(p); | ||
21 | } | 25 | } |
22 | 26 | ||
23 | +/* | 27 | /* Called with s->mutex held. */ |
24 | + * qemu_io_alloc_from_file() | 28 | -static void curl_multi_do_locked(CURLSocket *ready_socket) |
25 | + * | 29 | +static void curl_multi_do_locked(CURLSocket *socket) |
26 | + * Allocates the buffer and populates it with the content of the given file | ||
27 | + * up to @len bytes. If the file length is less than @len, then the buffer | ||
28 | + * is populated with the file content cyclically. | ||
29 | + * | ||
30 | + * @blk - the block backend where the buffer content is going to be written to | ||
31 | + * @len - the buffer length | ||
32 | + * @file_name - the file to read the content from | ||
33 | + * | ||
34 | + * Returns: the buffer pointer on success | ||
35 | + * NULL on error | ||
36 | + */ | ||
37 | +static void *qemu_io_alloc_from_file(BlockBackend *blk, size_t len, | ||
38 | + const char *file_name) | ||
39 | +{ | ||
40 | + char *buf, *buf_origin; | ||
41 | + FILE *f = fopen(file_name, "r"); | ||
42 | + int pattern_len; | ||
43 | + | ||
44 | + if (!f) { | ||
45 | + perror(file_name); | ||
46 | + return NULL; | ||
47 | + } | ||
48 | + | ||
49 | + if (qemuio_misalign) { | ||
50 | + len += MISALIGN_OFFSET; | ||
51 | + } | ||
52 | + | ||
53 | + buf_origin = buf = blk_blockalign(blk, len); | ||
54 | + | ||
55 | + if (qemuio_misalign) { | ||
56 | + buf_origin += MISALIGN_OFFSET; | ||
57 | + buf += MISALIGN_OFFSET; | ||
58 | + len -= MISALIGN_OFFSET; | ||
59 | + } | ||
60 | + | ||
61 | + pattern_len = fread(buf_origin, 1, len, f); | ||
62 | + | ||
63 | + if (ferror(f)) { | ||
64 | + perror(file_name); | ||
65 | + goto error; | ||
66 | + } | ||
67 | + | ||
68 | + if (pattern_len == 0) { | ||
69 | + fprintf(stderr, "%s: file is empty\n", file_name); | ||
70 | + goto error; | ||
71 | + } | ||
72 | + | ||
73 | + fclose(f); | ||
74 | + | ||
75 | + if (len > pattern_len) { | ||
76 | + len -= pattern_len; | ||
77 | + buf += pattern_len; | ||
78 | + | ||
79 | + while (len > 0) { | ||
80 | + size_t len_to_copy = MIN(pattern_len, len); | ||
81 | + | ||
82 | + memcpy(buf, buf_origin, len_to_copy); | ||
83 | + | ||
84 | + len -= len_to_copy; | ||
85 | + buf += len_to_copy; | ||
86 | + } | ||
87 | + } | ||
88 | + | ||
89 | + return buf_origin; | ||
90 | + | ||
91 | +error: | ||
92 | + qemu_io_free(buf_origin); | ||
93 | + return NULL; | ||
94 | +} | ||
95 | + | ||
96 | static void dump_buffer(const void *buffer, int64_t offset, int64_t len) | ||
97 | { | 30 | { |
98 | uint64_t i; | 31 | - CURLSocket *socket, *next_socket; |
99 | @@ -XXX,XX +XXX,XX @@ static void write_help(void) | 32 | - CURLState *s = ready_socket->state; |
100 | " -n, -- with -z, don't allow slow fallback\n" | 33 | + BDRVCURLState *s = socket->state->s; |
101 | " -p, -- ignored for backwards compatibility\n" | 34 | int running; |
102 | " -P, -- use different pattern to fill file\n" | 35 | int r; |
103 | +" -s, -- use a pattern file to fill the write buffer\n" | 36 | |
104 | " -C, -- report statistics in a machine parsable format\n" | 37 | - if (!s->s->multi) { |
105 | " -q, -- quiet mode, do not show I/O statistics\n" | 38 | + if (!s->multi) { |
106 | " -u, -- with -z, allow unmapping\n" | 39 | return; |
107 | @@ -XXX,XX +XXX,XX @@ static const cmdinfo_t write_cmd = { | ||
108 | .perm = BLK_PERM_WRITE, | ||
109 | .argmin = 2, | ||
110 | .argmax = -1, | ||
111 | - .args = "[-bcCfnquz] [-P pattern] off len", | ||
112 | + .args = "[-bcCfnquz] [-P pattern | -s source_file] off len", | ||
113 | .oneline = "writes a number of bytes at a specified offset", | ||
114 | .help = write_help, | ||
115 | }; | ||
116 | @@ -XXX,XX +XXX,XX @@ static int write_f(BlockBackend *blk, int argc, char **argv) | ||
117 | { | ||
118 | struct timespec t1, t2; | ||
119 | bool Cflag = false, qflag = false, bflag = false; | ||
120 | - bool Pflag = false, zflag = false, cflag = false; | ||
121 | + bool Pflag = false, zflag = false, cflag = false, sflag = false; | ||
122 | int flags = 0; | ||
123 | int c, cnt, ret; | ||
124 | char *buf = NULL; | ||
125 | @@ -XXX,XX +XXX,XX @@ static int write_f(BlockBackend *blk, int argc, char **argv) | ||
126 | /* Some compilers get confused and warn if this is not initialized. */ | ||
127 | int64_t total = 0; | ||
128 | int pattern = 0xcd; | ||
129 | + const char *file_name = NULL; | ||
130 | |||
131 | - while ((c = getopt(argc, argv, "bcCfnpP:quz")) != -1) { | ||
132 | + while ((c = getopt(argc, argv, "bcCfnpP:qs:uz")) != -1) { | ||
133 | switch (c) { | ||
134 | case 'b': | ||
135 | bflag = true; | ||
136 | @@ -XXX,XX +XXX,XX @@ static int write_f(BlockBackend *blk, int argc, char **argv) | ||
137 | case 'q': | ||
138 | qflag = true; | ||
139 | break; | ||
140 | + case 's': | ||
141 | + sflag = true; | ||
142 | + file_name = optarg; | ||
143 | + break; | ||
144 | case 'u': | ||
145 | flags |= BDRV_REQ_MAY_UNMAP; | ||
146 | break; | ||
147 | @@ -XXX,XX +XXX,XX @@ static int write_f(BlockBackend *blk, int argc, char **argv) | ||
148 | return -EINVAL; | ||
149 | } | 40 | } |
150 | 41 | ||
151 | - if (zflag && Pflag) { | 42 | - /* Need to use _SAFE because curl_multi_socket_action() may trigger |
152 | - printf("-z and -P cannot be specified at the same time\n"); | 43 | - * curl_sock_cb() which might modify this list */ |
153 | + if (zflag + Pflag + sflag > 1) { | 44 | - QLIST_FOREACH_SAFE(socket, &s->sockets, next, next_socket) { |
154 | + printf("Only one of -z, -P, and -s " | 45 | - do { |
155 | + "can be specified at the same time\n"); | 46 | - r = curl_multi_socket_action(s->s->multi, socket->fd, 0, &running); |
156 | return -EINVAL; | 47 | - } while (r == CURLM_CALL_MULTI_PERFORM); |
157 | } | 48 | - } |
158 | 49 | + do { | |
159 | @@ -XXX,XX +XXX,XX @@ static int write_f(BlockBackend *blk, int argc, char **argv) | 50 | + r = curl_multi_socket_action(s->multi, socket->fd, 0, &running); |
160 | } | 51 | + } while (r == CURLM_CALL_MULTI_PERFORM); |
161 | 52 | } | |
162 | if (!zflag) { | 53 | |
163 | - buf = qemu_io_alloc(blk, count, pattern); | 54 | static void curl_multi_do(void *arg) |
164 | + if (sflag) { | ||
165 | + buf = qemu_io_alloc_from_file(blk, count, file_name); | ||
166 | + if (!buf) { | ||
167 | + return -EINVAL; | ||
168 | + } | ||
169 | + } else { | ||
170 | + buf = qemu_io_alloc(blk, count, pattern); | ||
171 | + } | ||
172 | } | ||
173 | |||
174 | clock_gettime(CLOCK_MONOTONIC, &t1); | ||
175 | -- | 55 | -- |
176 | 2.21.0 | 56 | 2.21.0 |
177 | 57 | ||
178 | 58 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Background: As of cURL 7.59.0, it verifies that several functions are | ||
2 | not called from within a callback. Among these functions is | ||
3 | curl_multi_add_handle(). | ||
1 | 4 | ||
5 | curl_read_cb() is a callback from cURL and not a coroutine. Waking up | ||
6 | acb->co will lead to entering it then and there, which means the current | ||
7 | request will settle and the caller (if it runs in the same coroutine) | ||
8 | may then issue the next request. In such a case, we will enter | ||
9 | curl_setup_preadv() effectively from within curl_read_cb(). | ||
10 | |||
11 | Calling curl_multi_add_handle() will then fail and the new request will | ||
12 | not be processed. | ||
13 | |||
14 | Fix this by not letting curl_read_cb() wake up acb->co. Instead, leave | ||
15 | the whole business of settling the AIOCB objects to | ||
16 | curl_multi_check_completion() (which is called from our timer callback | ||
17 | and our FD handler, so not from any cURL callbacks). | ||
18 | |||
19 | Reported-by: Natalie Gavrielov <ngavrilo@redhat.com> | ||
20 | Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1740193 | ||
21 | Cc: qemu-stable@nongnu.org | ||
22 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
23 | Message-id: 20190910124136.10565-7-mreitz@redhat.com | ||
24 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
25 | Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> | ||
26 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
27 | --- | ||
28 | block/curl.c | 69 ++++++++++++++++++++++------------------------------ | ||
29 | 1 file changed, 29 insertions(+), 40 deletions(-) | ||
30 | |||
31 | diff --git a/block/curl.c b/block/curl.c | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/block/curl.c | ||
34 | +++ b/block/curl.c | ||
35 | @@ -XXX,XX +XXX,XX @@ static size_t curl_read_cb(void *ptr, size_t size, size_t nmemb, void *opaque) | ||
36 | { | ||
37 | CURLState *s = ((CURLState*)opaque); | ||
38 | size_t realsize = size * nmemb; | ||
39 | - int i; | ||
40 | |||
41 | trace_curl_read_cb(realsize); | ||
42 | |||
43 | @@ -XXX,XX +XXX,XX @@ static size_t curl_read_cb(void *ptr, size_t size, size_t nmemb, void *opaque) | ||
44 | memcpy(s->orig_buf + s->buf_off, ptr, realsize); | ||
45 | s->buf_off += realsize; | ||
46 | |||
47 | - for(i=0; i<CURL_NUM_ACB; i++) { | ||
48 | - CURLAIOCB *acb = s->acb[i]; | ||
49 | - | ||
50 | - if (!acb) | ||
51 | - continue; | ||
52 | - | ||
53 | - if ((s->buf_off >= acb->end)) { | ||
54 | - size_t request_length = acb->bytes; | ||
55 | - | ||
56 | - qemu_iovec_from_buf(acb->qiov, 0, s->orig_buf + acb->start, | ||
57 | - acb->end - acb->start); | ||
58 | - | ||
59 | - if (acb->end - acb->start < request_length) { | ||
60 | - size_t offset = acb->end - acb->start; | ||
61 | - qemu_iovec_memset(acb->qiov, offset, 0, | ||
62 | - request_length - offset); | ||
63 | - } | ||
64 | - | ||
65 | - acb->ret = 0; | ||
66 | - s->acb[i] = NULL; | ||
67 | - qemu_mutex_unlock(&s->s->mutex); | ||
68 | - aio_co_wake(acb->co); | ||
69 | - qemu_mutex_lock(&s->s->mutex); | ||
70 | - } | ||
71 | - } | ||
72 | - | ||
73 | read_end: | ||
74 | /* curl will error out if we do not return this value */ | ||
75 | return size * nmemb; | ||
76 | @@ -XXX,XX +XXX,XX @@ static void curl_multi_check_completion(BDRVCURLState *s) | ||
77 | break; | ||
78 | |||
79 | if (msg->msg == CURLMSG_DONE) { | ||
80 | + int i; | ||
81 | CURLState *state = NULL; | ||
82 | + bool error = msg->data.result != CURLE_OK; | ||
83 | + | ||
84 | curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, | ||
85 | (char **)&state); | ||
86 | |||
87 | - /* ACBs for successful messages get completed in curl_read_cb */ | ||
88 | - if (msg->data.result != CURLE_OK) { | ||
89 | - int i; | ||
90 | + if (error) { | ||
91 | static int errcount = 100; | ||
92 | |||
93 | /* Don't lose the original error message from curl, since | ||
94 | @@ -XXX,XX +XXX,XX @@ static void curl_multi_check_completion(BDRVCURLState *s) | ||
95 | error_report("curl: further errors suppressed"); | ||
96 | } | ||
97 | } | ||
98 | + } | ||
99 | |||
100 | - for (i = 0; i < CURL_NUM_ACB; i++) { | ||
101 | - CURLAIOCB *acb = state->acb[i]; | ||
102 | + for (i = 0; i < CURL_NUM_ACB; i++) { | ||
103 | + CURLAIOCB *acb = state->acb[i]; | ||
104 | |||
105 | - if (acb == NULL) { | ||
106 | - continue; | ||
107 | - } | ||
108 | + if (acb == NULL) { | ||
109 | + continue; | ||
110 | + } | ||
111 | + | ||
112 | + if (!error) { | ||
113 | + /* Assert that we have read all data */ | ||
114 | + assert(state->buf_off >= acb->end); | ||
115 | + | ||
116 | + qemu_iovec_from_buf(acb->qiov, 0, | ||
117 | + state->orig_buf + acb->start, | ||
118 | + acb->end - acb->start); | ||
119 | |||
120 | - acb->ret = -EIO; | ||
121 | - state->acb[i] = NULL; | ||
122 | - qemu_mutex_unlock(&s->mutex); | ||
123 | - aio_co_wake(acb->co); | ||
124 | - qemu_mutex_lock(&s->mutex); | ||
125 | + if (acb->end - acb->start < acb->bytes) { | ||
126 | + size_t offset = acb->end - acb->start; | ||
127 | + qemu_iovec_memset(acb->qiov, offset, 0, | ||
128 | + acb->bytes - offset); | ||
129 | + } | ||
130 | } | ||
131 | + | ||
132 | + acb->ret = error ? -EIO : 0; | ||
133 | + state->acb[i] = NULL; | ||
134 | + qemu_mutex_unlock(&s->mutex); | ||
135 | + aio_co_wake(acb->co); | ||
136 | + qemu_mutex_lock(&s->mutex); | ||
137 | } | ||
138 | |||
139 | curl_clean_state(state); | ||
140 | -- | ||
141 | 2.21.0 | ||
142 | |||
143 | diff view generated by jsdifflib |
1 | streamOptimized does not support writes that do not span exactly one | 1 | If we had done that all along, debugging would have been much simpler. |
---|---|---|---|
2 | cluster. Furthermore, it cannot rewrite already allocated clusters. | 2 | (Also, I/O errors are better than hangs.) |
3 | As such, many iotests do not work with it. Disable them. | ||
4 | 3 | ||
5 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 4 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
6 | Message-id: 20190815153638.4600-6-mreitz@redhat.com | 5 | Message-id: 20190910124136.10565-8-mreitz@redhat.com |
6 | Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> | ||
7 | Reviewed-by: John Snow <jsnow@redhat.com> | 7 | Reviewed-by: John Snow <jsnow@redhat.com> |
8 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 8 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
9 | --- | 9 | --- |
10 | tests/qemu-iotests/002 | 1 + | 10 | block/curl.c | 8 +++++++- |
11 | tests/qemu-iotests/003 | 1 + | 11 | 1 file changed, 7 insertions(+), 1 deletion(-) |
12 | tests/qemu-iotests/005 | 3 ++- | ||
13 | tests/qemu-iotests/009 | 1 + | ||
14 | tests/qemu-iotests/010 | 1 + | ||
15 | tests/qemu-iotests/011 | 1 + | ||
16 | tests/qemu-iotests/017 | 3 ++- | ||
17 | tests/qemu-iotests/018 | 3 ++- | ||
18 | tests/qemu-iotests/019 | 3 ++- | ||
19 | tests/qemu-iotests/020 | 3 ++- | ||
20 | tests/qemu-iotests/027 | 1 + | ||
21 | tests/qemu-iotests/032 | 1 + | ||
22 | tests/qemu-iotests/033 | 1 + | ||
23 | tests/qemu-iotests/034 | 3 ++- | ||
24 | tests/qemu-iotests/037 | 3 ++- | ||
25 | tests/qemu-iotests/063 | 3 ++- | ||
26 | tests/qemu-iotests/072 | 1 + | ||
27 | tests/qemu-iotests/105 | 3 ++- | ||
28 | tests/qemu-iotests/197 | 1 + | ||
29 | tests/qemu-iotests/215 | 1 + | ||
30 | tests/qemu-iotests/251 | 1 + | ||
31 | 21 files changed, 30 insertions(+), 9 deletions(-) | ||
32 | 12 | ||
33 | diff --git a/tests/qemu-iotests/002 b/tests/qemu-iotests/002 | 13 | diff --git a/block/curl.c b/block/curl.c |
34 | index XXXXXXX..XXXXXXX 100755 | 14 | index XXXXXXX..XXXXXXX 100644 |
35 | --- a/tests/qemu-iotests/002 | 15 | --- a/block/curl.c |
36 | +++ b/tests/qemu-iotests/002 | 16 | +++ b/block/curl.c |
37 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | 17 | @@ -XXX,XX +XXX,XX @@ static void curl_setup_preadv(BlockDriverState *bs, CURLAIOCB *acb) |
38 | 18 | trace_curl_setup_preadv(acb->bytes, start, state->range); | |
39 | _supported_fmt generic | 19 | curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range); |
40 | _supported_proto generic | 20 | |
41 | +_unsupported_imgopts "subformat=streamOptimized" | 21 | - curl_multi_add_handle(s->multi, state->curl); |
42 | 22 | + if (curl_multi_add_handle(s->multi, state->curl) != CURLM_OK) { | |
43 | 23 | + state->acb[0] = NULL; | |
44 | size=128M | 24 | + acb->ret = -EIO; |
45 | diff --git a/tests/qemu-iotests/003 b/tests/qemu-iotests/003 | 25 | + |
46 | index XXXXXXX..XXXXXXX 100755 | 26 | + curl_clean_state(state); |
47 | --- a/tests/qemu-iotests/003 | 27 | + goto out; |
48 | +++ b/tests/qemu-iotests/003 | 28 | + } |
49 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | 29 | |
50 | 30 | /* Tell curl it needs to kick things off */ | |
51 | _supported_fmt generic | 31 | curl_multi_socket_action(s->multi, CURL_SOCKET_TIMEOUT, 0, &running); |
52 | _supported_proto generic | ||
53 | +_unsupported_imgopts "subformat=streamOptimized" | ||
54 | |||
55 | size=128M | ||
56 | offset=67M | ||
57 | diff --git a/tests/qemu-iotests/005 b/tests/qemu-iotests/005 | ||
58 | index XXXXXXX..XXXXXXX 100755 | ||
59 | --- a/tests/qemu-iotests/005 | ||
60 | +++ b/tests/qemu-iotests/005 | ||
61 | @@ -XXX,XX +XXX,XX @@ _supported_fmt generic | ||
62 | _supported_proto generic | ||
63 | _supported_os Linux | ||
64 | _unsupported_imgopts "subformat=twoGbMaxExtentFlat" \ | ||
65 | - "subformat=twoGbMaxExtentSparse" | ||
66 | + "subformat=twoGbMaxExtentSparse" \ | ||
67 | + "subformat=streamOptimized" | ||
68 | |||
69 | # vpc is limited to 127GB, so we can't test it here | ||
70 | if [ "$IMGFMT" = "vpc" ]; then | ||
71 | diff --git a/tests/qemu-iotests/009 b/tests/qemu-iotests/009 | ||
72 | index XXXXXXX..XXXXXXX 100755 | ||
73 | --- a/tests/qemu-iotests/009 | ||
74 | +++ b/tests/qemu-iotests/009 | ||
75 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
76 | |||
77 | _supported_fmt generic | ||
78 | _supported_proto generic | ||
79 | +_unsupported_imgopts "subformat=streamOptimized" | ||
80 | |||
81 | |||
82 | size=6G | ||
83 | diff --git a/tests/qemu-iotests/010 b/tests/qemu-iotests/010 | ||
84 | index XXXXXXX..XXXXXXX 100755 | ||
85 | --- a/tests/qemu-iotests/010 | ||
86 | +++ b/tests/qemu-iotests/010 | ||
87 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
88 | |||
89 | _supported_fmt generic | ||
90 | _supported_proto generic | ||
91 | +_unsupported_imgopts "subformat=streamOptimized" | ||
92 | |||
93 | |||
94 | size=6G | ||
95 | diff --git a/tests/qemu-iotests/011 b/tests/qemu-iotests/011 | ||
96 | index XXXXXXX..XXXXXXX 100755 | ||
97 | --- a/tests/qemu-iotests/011 | ||
98 | +++ b/tests/qemu-iotests/011 | ||
99 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
100 | |||
101 | _supported_fmt generic | ||
102 | _supported_proto generic | ||
103 | +_unsupported_imgopts "subformat=streamOptimized" | ||
104 | |||
105 | |||
106 | size=6G | ||
107 | diff --git a/tests/qemu-iotests/017 b/tests/qemu-iotests/017 | ||
108 | index XXXXXXX..XXXXXXX 100755 | ||
109 | --- a/tests/qemu-iotests/017 | ||
110 | +++ b/tests/qemu-iotests/017 | ||
111 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
112 | _supported_fmt qcow qcow2 vmdk qed | ||
113 | _supported_proto generic | ||
114 | _unsupported_proto vxhs | ||
115 | -_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" | ||
116 | +_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" \ | ||
117 | + "subformat=streamOptimized" | ||
118 | |||
119 | TEST_OFFSETS="0 4294967296" | ||
120 | |||
121 | diff --git a/tests/qemu-iotests/018 b/tests/qemu-iotests/018 | ||
122 | index XXXXXXX..XXXXXXX 100755 | ||
123 | --- a/tests/qemu-iotests/018 | ||
124 | +++ b/tests/qemu-iotests/018 | ||
125 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
126 | _supported_fmt qcow qcow2 vmdk qed | ||
127 | _supported_proto file | ||
128 | _supported_os Linux | ||
129 | -_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" | ||
130 | +_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" \ | ||
131 | + "streamOptimized" | ||
132 | |||
133 | TEST_OFFSETS="0 4294967296" | ||
134 | |||
135 | diff --git a/tests/qemu-iotests/019 b/tests/qemu-iotests/019 | ||
136 | index XXXXXXX..XXXXXXX 100755 | ||
137 | --- a/tests/qemu-iotests/019 | ||
138 | +++ b/tests/qemu-iotests/019 | ||
139 | @@ -XXX,XX +XXX,XX @@ _supported_proto file | ||
140 | _supported_os Linux | ||
141 | _unsupported_imgopts "subformat=monolithicFlat" \ | ||
142 | "subformat=twoGbMaxExtentFlat" \ | ||
143 | - "subformat=twoGbMaxExtentSparse" | ||
144 | + "subformat=twoGbMaxExtentSparse" \ | ||
145 | + "subformat=streamOptimized" | ||
146 | |||
147 | TEST_OFFSETS="0 4294967296" | ||
148 | CLUSTER_SIZE=65536 | ||
149 | diff --git a/tests/qemu-iotests/020 b/tests/qemu-iotests/020 | ||
150 | index XXXXXXX..XXXXXXX 100755 | ||
151 | --- a/tests/qemu-iotests/020 | ||
152 | +++ b/tests/qemu-iotests/020 | ||
153 | @@ -XXX,XX +XXX,XX @@ _supported_fmt qcow qcow2 vmdk qed | ||
154 | _supported_proto file | ||
155 | _unsupported_imgopts "subformat=monolithicFlat" \ | ||
156 | "subformat=twoGbMaxExtentFlat" \ | ||
157 | - "subformat=twoGbMaxExtentSparse" | ||
158 | + "subformat=twoGbMaxExtentSparse" \ | ||
159 | + "subformat=streamOptimized" | ||
160 | |||
161 | TEST_OFFSETS="0 4294967296" | ||
162 | |||
163 | diff --git a/tests/qemu-iotests/027 b/tests/qemu-iotests/027 | ||
164 | index XXXXXXX..XXXXXXX 100755 | ||
165 | --- a/tests/qemu-iotests/027 | ||
166 | +++ b/tests/qemu-iotests/027 | ||
167 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
168 | |||
169 | _supported_fmt vmdk qcow qcow2 qed | ||
170 | _supported_proto generic | ||
171 | +_unsupported_imgopts "subformat=streamOptimized" | ||
172 | |||
173 | |||
174 | size=128M | ||
175 | diff --git a/tests/qemu-iotests/032 b/tests/qemu-iotests/032 | ||
176 | index XXXXXXX..XXXXXXX 100755 | ||
177 | --- a/tests/qemu-iotests/032 | ||
178 | +++ b/tests/qemu-iotests/032 | ||
179 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
180 | # This works for any image format (though unlikely to segfault for raw) | ||
181 | _supported_fmt generic | ||
182 | _supported_proto generic | ||
183 | +_unsupported_imgopts "subformat=streamOptimized" | ||
184 | |||
185 | echo | ||
186 | echo === Prepare image === | ||
187 | diff --git a/tests/qemu-iotests/033 b/tests/qemu-iotests/033 | ||
188 | index XXXXXXX..XXXXXXX 100755 | ||
189 | --- a/tests/qemu-iotests/033 | ||
190 | +++ b/tests/qemu-iotests/033 | ||
191 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
192 | |||
193 | _supported_fmt generic | ||
194 | _supported_proto generic | ||
195 | +_unsupported_imgopts "subformat=streamOptimized" | ||
196 | |||
197 | |||
198 | size=128M | ||
199 | diff --git a/tests/qemu-iotests/034 b/tests/qemu-iotests/034 | ||
200 | index XXXXXXX..XXXXXXX 100755 | ||
201 | --- a/tests/qemu-iotests/034 | ||
202 | +++ b/tests/qemu-iotests/034 | ||
203 | @@ -XXX,XX +XXX,XX @@ _supported_proto file | ||
204 | _supported_os Linux | ||
205 | _unsupported_imgopts "subformat=monolithicFlat" \ | ||
206 | "subformat=twoGbMaxExtentFlat" \ | ||
207 | - "subformat=twoGbMaxExtentSparse" | ||
208 | + "subformat=twoGbMaxExtentSparse" \ | ||
209 | + "subformat=streamOptimized" | ||
210 | |||
211 | CLUSTER_SIZE=4k | ||
212 | size=128M | ||
213 | diff --git a/tests/qemu-iotests/037 b/tests/qemu-iotests/037 | ||
214 | index XXXXXXX..XXXXXXX 100755 | ||
215 | --- a/tests/qemu-iotests/037 | ||
216 | +++ b/tests/qemu-iotests/037 | ||
217 | @@ -XXX,XX +XXX,XX @@ _supported_fmt qcow qcow2 vmdk qed | ||
218 | _supported_proto file | ||
219 | _unsupported_imgopts "subformat=monolithicFlat" \ | ||
220 | "subformat=twoGbMaxExtentFlat" \ | ||
221 | - "subformat=twoGbMaxExtentSparse" | ||
222 | + "subformat=twoGbMaxExtentSparse" \ | ||
223 | + "subformat=streamOptimized" | ||
224 | |||
225 | CLUSTER_SIZE=4k | ||
226 | size=128M | ||
227 | diff --git a/tests/qemu-iotests/063 b/tests/qemu-iotests/063 | ||
228 | index XXXXXXX..XXXXXXX 100755 | ||
229 | --- a/tests/qemu-iotests/063 | ||
230 | +++ b/tests/qemu-iotests/063 | ||
231 | @@ -XXX,XX +XXX,XX @@ _supported_fmt qcow qcow2 vmdk qed raw | ||
232 | _supported_proto file | ||
233 | _unsupported_imgopts "subformat=monolithicFlat" \ | ||
234 | "subformat=twoGbMaxExtentFlat" \ | ||
235 | - "subformat=twoGbMaxExtentSparse" | ||
236 | + "subformat=twoGbMaxExtentSparse" \ | ||
237 | + "subformat=streamOptimized" | ||
238 | |||
239 | _make_test_img 4M | ||
240 | |||
241 | diff --git a/tests/qemu-iotests/072 b/tests/qemu-iotests/072 | ||
242 | index XXXXXXX..XXXXXXX 100755 | ||
243 | --- a/tests/qemu-iotests/072 | ||
244 | +++ b/tests/qemu-iotests/072 | ||
245 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
246 | |||
247 | _supported_fmt vpc vmdk vhdx vdi qed qcow2 qcow | ||
248 | _supported_proto file | ||
249 | +_unsupported_imgopts "subformat=streamOptimized" | ||
250 | |||
251 | IMG_SIZE=64M | ||
252 | |||
253 | diff --git a/tests/qemu-iotests/105 b/tests/qemu-iotests/105 | ||
254 | index XXXXXXX..XXXXXXX 100755 | ||
255 | --- a/tests/qemu-iotests/105 | ||
256 | +++ b/tests/qemu-iotests/105 | ||
257 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
258 | _supported_fmt qcow2 vmdk vhdx qed | ||
259 | _supported_proto generic | ||
260 | _unsupported_imgopts "subformat=twoGbMaxExtentFlat" \ | ||
261 | - "subformat=twoGbMaxExtentSparse" | ||
262 | + "subformat=twoGbMaxExtentSparse" \ | ||
263 | + "subformat=streamOptimized" | ||
264 | |||
265 | echo | ||
266 | echo "creating large image" | ||
267 | diff --git a/tests/qemu-iotests/197 b/tests/qemu-iotests/197 | ||
268 | index XXXXXXX..XXXXXXX 100755 | ||
269 | --- a/tests/qemu-iotests/197 | ||
270 | +++ b/tests/qemu-iotests/197 | ||
271 | @@ -XXX,XX +XXX,XX @@ _supported_fmt generic | ||
272 | _supported_proto generic | ||
273 | # LUKS support may be possible, but it complicates things. | ||
274 | _unsupported_fmt luks | ||
275 | +_unsupported_imgopts "subformat=streamOptimized" | ||
276 | |||
277 | echo | ||
278 | echo '=== Copy-on-read ===' | ||
279 | diff --git a/tests/qemu-iotests/215 b/tests/qemu-iotests/215 | ||
280 | index XXXXXXX..XXXXXXX 100755 | ||
281 | --- a/tests/qemu-iotests/215 | ||
282 | +++ b/tests/qemu-iotests/215 | ||
283 | @@ -XXX,XX +XXX,XX @@ _supported_fmt generic | ||
284 | _supported_proto generic | ||
285 | # LUKS support may be possible, but it complicates things. | ||
286 | _unsupported_fmt luks | ||
287 | +_unsupported_imgopts "subformat=streamOptimized" | ||
288 | |||
289 | echo | ||
290 | echo '=== Copy-on-read ===' | ||
291 | diff --git a/tests/qemu-iotests/251 b/tests/qemu-iotests/251 | ||
292 | index XXXXXXX..XXXXXXX 100755 | ||
293 | --- a/tests/qemu-iotests/251 | ||
294 | +++ b/tests/qemu-iotests/251 | ||
295 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
296 | _supported_fmt generic | ||
297 | _supported_proto file | ||
298 | _supported_os Linux | ||
299 | +_unsupported_imgopts "subformat=streamOptimized" | ||
300 | |||
301 | if [ "$IMGOPTSSYNTAX" = "true" ]; then | ||
302 | # We use json:{} filenames here, so we cannot work with additional options. | ||
303 | -- | 32 | -- |
304 | 2.21.0 | 33 | 2.21.0 |
305 | 34 | ||
306 | 35 | diff view generated by jsdifflib |
1 | From: Stefan Hajnoczi <stefanha@redhat.com> | 1 | From: Sergio Lopez <slp@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Fixes: a6b257a08e3d72219f03e461a52152672fec0612 | 3 | block_job_remove_all_bdrv() iterates through job->nodes, calling |
4 | ("file-posix: Handle undetectable alignment") | 4 | bdrv_root_unref_child() for each entry. The call to the latter may |
5 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 5 | reach child_job_[can_]set_aio_ctx(), which will also attempt to |
6 | Message-id: 20190827101328.4062-1-stefanha@redhat.com | 6 | traverse job->nodes, potentially finding entries that where freed |
7 | Reviewed-by: Thomas Huth <thuth@redhat.com> | 7 | on previous iterations. |
8 | |||
9 | To avoid this situation, update job->nodes head on each iteration to | ||
10 | ensure that already freed entries are no longer linked to the list. | ||
11 | |||
12 | RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1746631 | ||
13 | Signed-off-by: Sergio Lopez <slp@redhat.com> | ||
14 | Cc: qemu-stable@nongnu.org | ||
15 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
16 | Message-id: 20190911100316.32282-1-mreitz@redhat.com | ||
17 | Reviewed-by: Sergio Lopez <slp@redhat.com> | ||
8 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 18 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
9 | --- | 19 | --- |
10 | block/file-posix.c | 2 +- | 20 | blockjob.c | 17 +++++++++++++---- |
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | 21 | 1 file changed, 13 insertions(+), 4 deletions(-) |
12 | 22 | ||
13 | diff --git a/block/file-posix.c b/block/file-posix.c | 23 | diff --git a/blockjob.c b/blockjob.c |
14 | index XXXXXXX..XXXXXXX 100644 | 24 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/block/file-posix.c | 25 | --- a/blockjob.c |
16 | +++ b/block/file-posix.c | 26 | +++ b/blockjob.c |
17 | @@ -XXX,XX +XXX,XX @@ static void raw_probe_alignment(BlockDriverState *bs, int fd, Error **errp) | 27 | @@ -XXX,XX +XXX,XX @@ static const BdrvChildRole child_job = { |
18 | for (i = 0; i < ARRAY_SIZE(alignments); i++) { | 28 | |
19 | align = alignments[i]; | 29 | void block_job_remove_all_bdrv(BlockJob *job) |
20 | if (raw_is_io_aligned(fd, buf + align, max_align)) { | 30 | { |
21 | - /* Fallback to request_aligment. */ | 31 | - GSList *l; |
22 | + /* Fallback to request_alignment. */ | 32 | - for (l = job->nodes; l; l = l->next) { |
23 | s->buf_align = (align != 1) ? align : bs->bl.request_alignment; | 33 | + /* |
24 | break; | 34 | + * bdrv_root_unref_child() may reach child_job_[can_]set_aio_ctx(), |
25 | } | 35 | + * which will also traverse job->nodes, so consume the list one by |
36 | + * one to make sure that such a concurrent access does not attempt | ||
37 | + * to process an already freed BdrvChild. | ||
38 | + */ | ||
39 | + while (job->nodes) { | ||
40 | + GSList *l = job->nodes; | ||
41 | BdrvChild *c = l->data; | ||
42 | + | ||
43 | + job->nodes = l->next; | ||
44 | + | ||
45 | bdrv_op_unblock_all(c->bs, job->blocker); | ||
46 | bdrv_root_unref_child(c); | ||
47 | + | ||
48 | + g_slist_free_1(l); | ||
49 | } | ||
50 | - g_slist_free(job->nodes); | ||
51 | - job->nodes = NULL; | ||
52 | } | ||
53 | |||
54 | bool block_job_has_bdrv(BlockJob *job, BlockDriverState *bs) | ||
26 | -- | 55 | -- |
27 | 2.21.0 | 56 | 2.21.0 |
28 | 57 | ||
29 | 58 | diff view generated by jsdifflib |
1 | fe646693acc changed qemu-img create's output so that it no longer prints | 1 | From: Maxim Levitsky <mlevitsk@redhat.com> |
---|---|---|---|
2 | single quotes around parameter values. The subformat and adapter_type | ||
3 | filters in _filter_img_create() have never been adapted to that change. | ||
4 | 2 | ||
5 | Fixes: fe646693acc13ac48b98435d14149ab04dc597bc | 3 | This fixes subtle corruption introduced by luks threaded encryption |
6 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 4 | in commit 8ac0f15f335 |
7 | Reviewed-by: John Snow <jsnow@redhat.com> | 5 | |
8 | Message-id: 20190815153638.4600-2-mreitz@redhat.com | 6 | Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1745922 |
9 | Reviewed-by: John Snow <jsnow@redhat.com> | 7 | |
8 | The corruption happens when we do a write that | ||
9 | * writes to two or more unallocated clusters at once | ||
10 | * doesn't fully cover the first sector | ||
11 | * doesn't fully cover the last sector | ||
12 | * uses luks encryption | ||
13 | |||
14 | In this case, when allocating the new clusters we COW both areas | ||
15 | prior to the write and after the write, and we encrypt them. | ||
16 | |||
17 | The above mentioned commit accidentally made it so we encrypt the | ||
18 | second COW area using the physical cluster offset of the first area. | ||
19 | |||
20 | The problem is that offset_in_cluster in do_perform_cow_encrypt | ||
21 | can be larger that the cluster size, thus cluster_offset | ||
22 | will no longer point to the start of the cluster at which encrypted | ||
23 | area starts. | ||
24 | |||
25 | Next patch in this series will refactor the code to avoid all these | ||
26 | assumptions. | ||
27 | |||
28 | In the bugreport that was triggered by rebasing a luks image to new, | ||
29 | zero filled base, which lot of such writes, and causes some files | ||
30 | with zero areas to contain garbage there instead. | ||
31 | But as described above it can happen elsewhere as well | ||
32 | |||
33 | Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> | ||
34 | Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
35 | Message-id: 20190915203655.21638-2-mlevitsk@redhat.com | ||
36 | Reviewed-by: Max Reitz <mreitz@redhat.com> | ||
10 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 37 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
11 | --- | 38 | --- |
12 | tests/qemu-iotests/059.out | 16 ++++++++-------- | 39 | block/qcow2-cluster.c | 7 ++++--- |
13 | tests/qemu-iotests/common.filter | 4 ++-- | 40 | 1 file changed, 4 insertions(+), 3 deletions(-) |
14 | 2 files changed, 10 insertions(+), 10 deletions(-) | ||
15 | 41 | ||
16 | diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out | 42 | diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c |
17 | index XXXXXXX..XXXXXXX 100644 | 43 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/tests/qemu-iotests/059.out | 44 | --- a/block/qcow2-cluster.c |
19 | +++ b/tests/qemu-iotests/059.out | 45 | +++ b/block/qcow2-cluster.c |
20 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | 46 | @@ -XXX,XX +XXX,XX @@ static bool coroutine_fn do_perform_cow_encrypt(BlockDriverState *bs, |
21 | qemu-io: can't open device TEST_DIR/t.vmdk: L1 size too big | 47 | assert(QEMU_IS_ALIGNED(offset_in_cluster, BDRV_SECTOR_SIZE)); |
22 | 48 | assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); | |
23 | === Testing monolithicFlat creation and opening === | 49 | assert(s->crypto); |
24 | -Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 subformat=monolithicFlat | 50 | - if (qcow2_co_encrypt(bs, cluster_offset, |
25 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 | 51 | - src_cluster_offset + offset_in_cluster, |
26 | image: TEST_DIR/t.IMGFMT | 52 | - buffer, bytes) < 0) { |
27 | file format: IMGFMT | 53 | + if (qcow2_co_encrypt(bs, |
28 | virtual size: 2 GiB (2147483648 bytes) | 54 | + start_of_cluster(s, cluster_offset + offset_in_cluster), |
29 | 55 | + src_cluster_offset + offset_in_cluster, | |
30 | === Testing monolithicFlat with zeroed_grain === | 56 | + buffer, bytes) < 0) { |
31 | qemu-img: TEST_DIR/t.IMGFMT: Flat image can't enable zeroed grain | 57 | return false; |
32 | -Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 subformat=monolithicFlat | 58 | } |
33 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 | 59 | } |
34 | |||
35 | === Testing big twoGbMaxExtentFlat === | ||
36 | -Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824000 subformat=twoGbMaxExtentFlat | ||
37 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824000 | ||
38 | image: TEST_DIR/t.vmdk | ||
39 | file format: vmdk | ||
40 | virtual size: 0.977 TiB (1073741824000 bytes) | ||
41 | @@ -XXX,XX +XXX,XX @@ Format specific information: | ||
42 | qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Invalid extent line: RW 12582912 VMFS "dummy.IMGFMT" 1 | ||
43 | |||
44 | === Testing truncated sparse === | ||
45 | -Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=107374182400 subformat=monolithicSparse | ||
46 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=107374182400 | ||
47 | qemu-img: Could not open 'TEST_DIR/t.IMGFMT': File truncated, expecting at least 13172736 bytes | ||
48 | |||
49 | === Converting to streamOptimized from image with small cluster size=== | ||
50 | @@ -XXX,XX +XXX,XX @@ wrote 512/512 bytes at offset 10240 | ||
51 | 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
52 | |||
53 | === Testing monolithicFlat with internally generated JSON file name === | ||
54 | -Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 subformat=monolithicFlat | ||
55 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
56 | qemu-io: can't open: Cannot use relative extent paths with VMDK descriptor file 'json:{"image": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, "driver": "blkdebug", "inject-error.0.event": "read_aio"}' | ||
57 | |||
58 | === Testing version 3 === | ||
59 | @@ -XXX,XX +XXX,XX @@ read 512/512 bytes at offset 64931328 | ||
60 | 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
61 | |||
62 | === Testing 4TB monolithicFlat creation and IO === | ||
63 | -Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4398046511104 subformat=monolithicFlat | ||
64 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4398046511104 | ||
65 | image: TEST_DIR/t.IMGFMT | ||
66 | file format: IMGFMT | ||
67 | virtual size: 4 TiB (4398046511104 bytes) | ||
68 | @@ -XXX,XX +XXX,XX @@ read 1024/1024 bytes at offset 966367641600 | ||
69 | 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
70 | |||
71 | === Testing qemu-img map on extents === | ||
72 | -Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=33285996544 subformat=monolithicSparse | ||
73 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=33285996544 | ||
74 | wrote 1024/1024 bytes at offset 65024 | ||
75 | 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
76 | wrote 1024/1024 bytes at offset 2147483136 | ||
77 | @@ -XXX,XX +XXX,XX @@ Offset Length Mapped to File | ||
78 | 0 0x20000 0x3f0000 TEST_DIR/t.vmdk | ||
79 | 0x7fff0000 0x20000 0x410000 TEST_DIR/t.vmdk | ||
80 | 0x140000000 0x10000 0x430000 TEST_DIR/t.vmdk | ||
81 | -Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=33285996544 subformat=twoGbMaxExtentSparse | ||
82 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=33285996544 | ||
83 | wrote 1024/1024 bytes at offset 65024 | ||
84 | 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
85 | wrote 1024/1024 bytes at offset 2147483136 | ||
86 | diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter | ||
87 | index XXXXXXX..XXXXXXX 100644 | ||
88 | --- a/tests/qemu-iotests/common.filter | ||
89 | +++ b/tests/qemu-iotests/common.filter | ||
90 | @@ -XXX,XX +XXX,XX @@ _filter_img_create() | ||
91 | -e "s# compat6=\\(on\\|off\\)##g" \ | ||
92 | -e "s# static=\\(on\\|off\\)##g" \ | ||
93 | -e "s# zeroed_grain=\\(on\\|off\\)##g" \ | ||
94 | - -e "s# subformat='[^']*'##g" \ | ||
95 | - -e "s# adapter_type='[^']*'##g" \ | ||
96 | + -e "s# subformat=[^ ]*##g" \ | ||
97 | + -e "s# adapter_type=[^ ]*##g" \ | ||
98 | -e "s# hwversion=[^ ]*##g" \ | ||
99 | -e "s# lazy_refcounts=\\(on\\|off\\)##g" \ | ||
100 | -e "s# block_size=[0-9]\\+##g" \ | ||
101 | -- | 60 | -- |
102 | 2.21.0 | 61 | 2.21.0 |
103 | 62 | ||
104 | 63 | diff view generated by jsdifflib |
1 | Compressed writes generally have to write full clusters, not just in | 1 | From: Maxim Levitsky <mlevitsk@redhat.com> |
---|---|---|---|
2 | theory but also in practice when it comes to vmdk's streamOptimized | 2 | |
3 | subformat. It currently is just silently broken for writes with | 3 | * Change the qcow2_co_{encrypt|decrypt} to just receive full host and |
4 | non-zero in-cluster offsets: | 4 | guest offsets and use this function directly instead of calling |
5 | 5 | do_perform_cow_encrypt (which is removed by that patch). | |
6 | $ qemu-img create -f vmdk -o subformat=streamOptimized foo.vmdk 1M | 6 | |
7 | $ qemu-io -c 'write 4k 4k' -c 'read 4k 4k' foo.vmdk | 7 | * Adjust qcow2_co_encdec to take full host and guest offsets as well. |
8 | wrote 4096/4096 bytes at offset 4096 | 8 | |
9 | 4 KiB, 1 ops; 00.01 sec (443.724 KiB/sec and 110.9309 ops/sec) | 9 | * Document the qcow2_co_{encrypt|decrypt} arguments |
10 | read failed: Invalid argument | 10 | to prevent the bug fixed in former commit from hopefully |
11 | 11 | happening again. | |
12 | (The technical reason is that vmdk_write_extent() just writes the | 12 | |
13 | incomplete compressed data actually to offset 4k. When reading the | 13 | Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> |
14 | data, vmdk_read_extent() looks at offset 0 and finds the compressed data | 14 | Message-id: 20190915203655.21638-3-mlevitsk@redhat.com |
15 | size to be 0, because that is what it reads from there. This yields an | 15 | Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
16 | error.) | 16 | [mreitz: Let perform_cow() return the error value returned by |
17 | 17 | qcow2_co_encrypt(), as proposed by Vladimir] | |
18 | For incomplete writes with zero in-cluster offsets, the error path when | ||
19 | reading the rest of the cluster is a bit different, but the result is | ||
20 | the same: | ||
21 | |||
22 | $ qemu-img create -f vmdk -o subformat=streamOptimized foo.vmdk 1M | ||
23 | $ qemu-io -c 'write 0k 4k' -c 'read 4k 4k' foo.vmdk | ||
24 | wrote 4096/4096 bytes at offset 0 | ||
25 | 4 KiB, 1 ops; 00.01 sec (362.641 KiB/sec and 90.6603 ops/sec) | ||
26 | read failed: Invalid argument | ||
27 | |||
28 | (Here, vmdk_read_extent() finds the data and then sees that the | ||
29 | uncompressed data is short.) | ||
30 | |||
31 | It is better to reject invalid writes than to make the user believe they | ||
32 | might have succeeded and then fail when trying to read it back. | ||
33 | |||
34 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
35 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
36 | Message-id: 20190815153638.4600-5-mreitz@redhat.com | ||
37 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
38 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 18 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
39 | --- | 19 | --- |
40 | block/vmdk.c | 10 ++++++++++ | 20 | block/qcow2.h | 8 +++--- |
41 | 1 file changed, 10 insertions(+) | 21 | block/qcow2-cluster.c | 41 +++++++++------------------- |
42 | 22 | block/qcow2-threads.c | 63 +++++++++++++++++++++++++++++++++---------- | |
43 | diff --git a/block/vmdk.c b/block/vmdk.c | 23 | block/qcow2.c | 5 ++-- |
44 | index XXXXXXX..XXXXXXX 100644 | 24 | 4 files changed, 69 insertions(+), 48 deletions(-) |
45 | --- a/block/vmdk.c | 25 | |
46 | +++ b/block/vmdk.c | 26 | diff --git a/block/qcow2.h b/block/qcow2.h |
47 | @@ -XXX,XX +XXX,XX @@ static int vmdk_write_extent(VmdkExtent *extent, int64_t cluster_offset, | 27 | index XXXXXXX..XXXXXXX 100644 |
48 | if (extent->compressed) { | 28 | --- a/block/qcow2.h |
49 | void *compressed_data; | 29 | +++ b/block/qcow2.h |
50 | 30 | @@ -XXX,XX +XXX,XX @@ ssize_t coroutine_fn | |
51 | + /* Only whole clusters */ | 31 | qcow2_co_decompress(BlockDriverState *bs, void *dest, size_t dest_size, |
52 | + if (offset_in_cluster || | 32 | const void *src, size_t src_size); |
53 | + n_bytes > (extent->cluster_sectors * SECTOR_SIZE) || | 33 | int coroutine_fn |
54 | + (n_bytes < (extent->cluster_sectors * SECTOR_SIZE) && | 34 | -qcow2_co_encrypt(BlockDriverState *bs, uint64_t file_cluster_offset, |
55 | + offset + n_bytes != extent->end_sector * SECTOR_SIZE)) | 35 | - uint64_t offset, void *buf, size_t len); |
56 | + { | 36 | +qcow2_co_encrypt(BlockDriverState *bs, uint64_t host_offset, |
57 | + ret = -EINVAL; | 37 | + uint64_t guest_offset, void *buf, size_t len); |
58 | + goto out; | 38 | int coroutine_fn |
39 | -qcow2_co_decrypt(BlockDriverState *bs, uint64_t file_cluster_offset, | ||
40 | - uint64_t offset, void *buf, size_t len); | ||
41 | +qcow2_co_decrypt(BlockDriverState *bs, uint64_t host_offset, | ||
42 | + uint64_t guest_offset, void *buf, size_t len); | ||
43 | |||
44 | #endif | ||
45 | diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c | ||
46 | index XXXXXXX..XXXXXXX 100644 | ||
47 | --- a/block/qcow2-cluster.c | ||
48 | +++ b/block/qcow2-cluster.c | ||
49 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn do_perform_cow_read(BlockDriverState *bs, | ||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | -static bool coroutine_fn do_perform_cow_encrypt(BlockDriverState *bs, | ||
54 | - uint64_t src_cluster_offset, | ||
55 | - uint64_t cluster_offset, | ||
56 | - unsigned offset_in_cluster, | ||
57 | - uint8_t *buffer, | ||
58 | - unsigned bytes) | ||
59 | -{ | ||
60 | - if (bytes && bs->encrypted) { | ||
61 | - BDRVQcow2State *s = bs->opaque; | ||
62 | - assert(QEMU_IS_ALIGNED(offset_in_cluster, BDRV_SECTOR_SIZE)); | ||
63 | - assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); | ||
64 | - assert(s->crypto); | ||
65 | - if (qcow2_co_encrypt(bs, | ||
66 | - start_of_cluster(s, cluster_offset + offset_in_cluster), | ||
67 | - src_cluster_offset + offset_in_cluster, | ||
68 | - buffer, bytes) < 0) { | ||
69 | - return false; | ||
70 | - } | ||
71 | - } | ||
72 | - return true; | ||
73 | -} | ||
74 | - | ||
75 | static int coroutine_fn do_perform_cow_write(BlockDriverState *bs, | ||
76 | uint64_t cluster_offset, | ||
77 | unsigned offset_in_cluster, | ||
78 | @@ -XXX,XX +XXX,XX @@ static int perform_cow(BlockDriverState *bs, QCowL2Meta *m) | ||
79 | |||
80 | /* Encrypt the data if necessary before writing it */ | ||
81 | if (bs->encrypted) { | ||
82 | - if (!do_perform_cow_encrypt(bs, m->offset, m->alloc_offset, | ||
83 | - start->offset, start_buffer, | ||
84 | - start->nb_bytes) || | ||
85 | - !do_perform_cow_encrypt(bs, m->offset, m->alloc_offset, | ||
86 | - end->offset, end_buffer, end->nb_bytes)) { | ||
87 | - ret = -EIO; | ||
88 | + ret = qcow2_co_encrypt(bs, | ||
89 | + m->alloc_offset + start->offset, | ||
90 | + m->offset + start->offset, | ||
91 | + start_buffer, start->nb_bytes); | ||
92 | + if (ret < 0) { | ||
93 | + goto fail; | ||
59 | + } | 94 | + } |
60 | + | 95 | + |
61 | if (!extent->has_marker) { | 96 | + ret = qcow2_co_encrypt(bs, |
62 | ret = -EINVAL; | 97 | + m->alloc_offset + end->offset, |
63 | goto out; | 98 | + m->offset + end->offset, |
99 | + end_buffer, end->nb_bytes); | ||
100 | + if (ret < 0) { | ||
101 | goto fail; | ||
102 | } | ||
103 | } | ||
104 | diff --git a/block/qcow2-threads.c b/block/qcow2-threads.c | ||
105 | index XXXXXXX..XXXXXXX 100644 | ||
106 | --- a/block/qcow2-threads.c | ||
107 | +++ b/block/qcow2-threads.c | ||
108 | @@ -XXX,XX +XXX,XX @@ static int qcow2_encdec_pool_func(void *opaque) | ||
109 | } | ||
110 | |||
111 | static int coroutine_fn | ||
112 | -qcow2_co_encdec(BlockDriverState *bs, uint64_t file_cluster_offset, | ||
113 | - uint64_t offset, void *buf, size_t len, Qcow2EncDecFunc func) | ||
114 | +qcow2_co_encdec(BlockDriverState *bs, uint64_t host_offset, | ||
115 | + uint64_t guest_offset, void *buf, size_t len, | ||
116 | + Qcow2EncDecFunc func) | ||
117 | { | ||
118 | BDRVQcow2State *s = bs->opaque; | ||
119 | Qcow2EncDecData arg = { | ||
120 | .block = s->crypto, | ||
121 | - .offset = s->crypt_physical_offset ? | ||
122 | - file_cluster_offset + offset_into_cluster(s, offset) : | ||
123 | - offset, | ||
124 | + .offset = s->crypt_physical_offset ? host_offset : guest_offset, | ||
125 | .buf = buf, | ||
126 | .len = len, | ||
127 | .func = func, | ||
128 | }; | ||
129 | |||
130 | - return qcow2_co_process(bs, qcow2_encdec_pool_func, &arg); | ||
131 | + assert(QEMU_IS_ALIGNED(guest_offset, BDRV_SECTOR_SIZE)); | ||
132 | + assert(QEMU_IS_ALIGNED(host_offset, BDRV_SECTOR_SIZE)); | ||
133 | + assert(QEMU_IS_ALIGNED(len, BDRV_SECTOR_SIZE)); | ||
134 | + assert(s->crypto); | ||
135 | + | ||
136 | + return len == 0 ? 0 : qcow2_co_process(bs, qcow2_encdec_pool_func, &arg); | ||
137 | } | ||
138 | |||
139 | +/* | ||
140 | + * qcow2_co_encrypt() | ||
141 | + * | ||
142 | + * Encrypts one or more contiguous aligned sectors | ||
143 | + * | ||
144 | + * @host_offset - underlying storage offset of the first sector of the | ||
145 | + * data to be encrypted | ||
146 | + * | ||
147 | + * @guest_offset - guest (virtual) offset of the first sector of the | ||
148 | + * data to be encrypted | ||
149 | + * | ||
150 | + * @buf - buffer with the data to encrypt, that after encryption | ||
151 | + * will be written to the underlying storage device at | ||
152 | + * @host_offset | ||
153 | + * | ||
154 | + * @len - length of the buffer (must be a BDRV_SECTOR_SIZE multiple) | ||
155 | + * | ||
156 | + * Depending on the encryption method, @host_offset and/or @guest_offset | ||
157 | + * may be used for generating the initialization vector for | ||
158 | + * encryption. | ||
159 | + * | ||
160 | + * Note that while the whole range must be aligned on sectors, it | ||
161 | + * does not have to be aligned on clusters and can also cross cluster | ||
162 | + * boundaries | ||
163 | + */ | ||
164 | int coroutine_fn | ||
165 | -qcow2_co_encrypt(BlockDriverState *bs, uint64_t file_cluster_offset, | ||
166 | - uint64_t offset, void *buf, size_t len) | ||
167 | +qcow2_co_encrypt(BlockDriverState *bs, uint64_t host_offset, | ||
168 | + uint64_t guest_offset, void *buf, size_t len) | ||
169 | { | ||
170 | - return qcow2_co_encdec(bs, file_cluster_offset, offset, buf, len, | ||
171 | - qcrypto_block_encrypt); | ||
172 | + return qcow2_co_encdec(bs, host_offset, guest_offset, buf, len, | ||
173 | + qcrypto_block_encrypt); | ||
174 | } | ||
175 | |||
176 | +/* | ||
177 | + * qcow2_co_decrypt() | ||
178 | + * | ||
179 | + * Decrypts one or more contiguous aligned sectors | ||
180 | + * Similar to qcow2_co_encrypt | ||
181 | + */ | ||
182 | int coroutine_fn | ||
183 | -qcow2_co_decrypt(BlockDriverState *bs, uint64_t file_cluster_offset, | ||
184 | - uint64_t offset, void *buf, size_t len) | ||
185 | +qcow2_co_decrypt(BlockDriverState *bs, uint64_t host_offset, | ||
186 | + uint64_t guest_offset, void *buf, size_t len) | ||
187 | { | ||
188 | - return qcow2_co_encdec(bs, file_cluster_offset, offset, buf, len, | ||
189 | - qcrypto_block_decrypt); | ||
190 | + return qcow2_co_encdec(bs, host_offset, guest_offset, buf, len, | ||
191 | + qcrypto_block_decrypt); | ||
192 | } | ||
193 | diff --git a/block/qcow2.c b/block/qcow2.c | ||
194 | index XXXXXXX..XXXXXXX 100644 | ||
195 | --- a/block/qcow2.c | ||
196 | +++ b/block/qcow2.c | ||
197 | @@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow2_co_preadv_part(BlockDriverState *bs, | ||
198 | |||
199 | assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); | ||
200 | assert(QEMU_IS_ALIGNED(cur_bytes, BDRV_SECTOR_SIZE)); | ||
201 | - if (qcow2_co_decrypt(bs, cluster_offset, offset, | ||
202 | + if (qcow2_co_decrypt(bs, cluster_offset + offset_in_cluster, | ||
203 | + offset, | ||
204 | cluster_data, cur_bytes) < 0) { | ||
205 | ret = -EIO; | ||
206 | goto fail; | ||
207 | @@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow2_co_pwritev_part( | ||
208 | qemu_iovec_to_buf(qiov, qiov_offset + bytes_done, | ||
209 | cluster_data, cur_bytes); | ||
210 | |||
211 | - if (qcow2_co_encrypt(bs, cluster_offset, offset, | ||
212 | + if (qcow2_co_encrypt(bs, cluster_offset + offset_in_cluster, offset, | ||
213 | cluster_data, cur_bytes) < 0) { | ||
214 | ret = -EIO; | ||
215 | goto out_unlocked; | ||
64 | -- | 216 | -- |
65 | 2.21.0 | 217 | 2.21.0 |
66 | 218 | ||
67 | 219 | diff view generated by jsdifflib |
1 | From: Nir Soffer <nirsof@gmail.com> | 1 | From: Maxim Levitsky <mlevitsk@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | When creating an image with preallocation "off" or "falloc", the first | 3 | Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> |
4 | block of the image is typically not allocated. When using Gluster | 4 | Tested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
5 | storage backed by XFS filesystem, reading this block using direct I/O | 5 | Message-id: 20190915203655.21638-4-mlevitsk@redhat.com |
6 | succeeds regardless of request length, fooling alignment detection. | ||
7 | |||
8 | In this case we fallback to a safe value (4096) instead of the optimal | ||
9 | value (512), which may lead to unneeded data copying when aligning | ||
10 | requests. Allocating the first block avoids the fallback. | ||
11 | |||
12 | Since we allocate the first block even with preallocation=off, we no | ||
13 | longer create images with zero disk size: | ||
14 | |||
15 | $ ./qemu-img create -f raw test.raw 1g | ||
16 | Formatting 'test.raw', fmt=raw size=1073741824 | ||
17 | |||
18 | $ ls -lhs test.raw | ||
19 | 4.0K -rw-r--r--. 1 nsoffer nsoffer 1.0G Aug 16 23:48 test.raw | ||
20 | |||
21 | And converting the image requires additional cluster: | ||
22 | |||
23 | $ ./qemu-img measure -f raw -O qcow2 test.raw | ||
24 | required size: 458752 | ||
25 | fully allocated size: 1074135040 | ||
26 | |||
27 | When using format like vmdk with multiple files per image, we allocate | ||
28 | one block per file: | ||
29 | |||
30 | $ ./qemu-img create -f vmdk -o subformat=twoGbMaxExtentFlat test.vmdk 4g | ||
31 | Formatting 'test.vmdk', fmt=vmdk size=4294967296 compat6=off hwversion=undefined subformat=twoGbMaxExtentFlat | ||
32 | |||
33 | $ ls -lhs test*.vmdk | ||
34 | 4.0K -rw-r--r--. 1 nsoffer nsoffer 2.0G Aug 27 03:23 test-f001.vmdk | ||
35 | 4.0K -rw-r--r--. 1 nsoffer nsoffer 2.0G Aug 27 03:23 test-f002.vmdk | ||
36 | 4.0K -rw-r--r--. 1 nsoffer nsoffer 353 Aug 27 03:23 test.vmdk | ||
37 | |||
38 | I did quick performance test for copying disks with qemu-img convert to | ||
39 | new raw target image to Gluster storage with sector size of 512 bytes: | ||
40 | |||
41 | for i in $(seq 10); do | ||
42 | rm -f dst.raw | ||
43 | sleep 10 | ||
44 | time ./qemu-img convert -f raw -O raw -t none -T none src.raw dst.raw | ||
45 | done | ||
46 | |||
47 | Here is a table comparing the total time spent: | ||
48 | |||
49 | Type Before(s) After(s) Diff(%) | ||
50 | --------------------------------------- | ||
51 | real 530.028 469.123 -11.4 | ||
52 | user 17.204 10.768 -37.4 | ||
53 | sys 17.881 7.011 -60.7 | ||
54 | |||
55 | We can see very clear improvement in CPU usage. | ||
56 | |||
57 | Signed-off-by: Nir Soffer <nsoffer@redhat.com> | ||
58 | Message-id: 20190827010528.8818-2-nsoffer@redhat.com | ||
59 | Reviewed-by: Max Reitz <mreitz@redhat.com> | 6 | Reviewed-by: Max Reitz <mreitz@redhat.com> |
60 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 7 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
61 | --- | 8 | --- |
62 | block/file-posix.c | 51 +++++++++++++++++++ | 9 | tests/qemu-iotests/263 | 91 ++++++++++++++++++++++++++++++++++++++ |
63 | tests/qemu-iotests/059.out | 2 +- | 10 | tests/qemu-iotests/263.out | 40 +++++++++++++++++ |
64 | tests/qemu-iotests/{150.out => 150.out.qcow2} | 0 | 11 | tests/qemu-iotests/group | 1 + |
65 | tests/qemu-iotests/150.out.raw | 12 +++++ | 12 | 3 files changed, 132 insertions(+) |
66 | tests/qemu-iotests/175 | 19 ++++--- | 13 | create mode 100755 tests/qemu-iotests/263 |
67 | tests/qemu-iotests/175.out | 8 +-- | 14 | create mode 100644 tests/qemu-iotests/263.out |
68 | tests/qemu-iotests/178.out.qcow2 | 4 +- | ||
69 | tests/qemu-iotests/221.out | 12 +++-- | ||
70 | tests/qemu-iotests/253.out | 12 +++-- | ||
71 | 9 files changed, 99 insertions(+), 21 deletions(-) | ||
72 | rename tests/qemu-iotests/{150.out => 150.out.qcow2} (100%) | ||
73 | create mode 100644 tests/qemu-iotests/150.out.raw | ||
74 | 15 | ||
75 | diff --git a/block/file-posix.c b/block/file-posix.c | 16 | diff --git a/tests/qemu-iotests/263 b/tests/qemu-iotests/263 |
76 | index XXXXXXX..XXXXXXX 100644 | 17 | new file mode 100755 |
77 | --- a/block/file-posix.c | 18 | index XXXXXXX..XXXXXXX |
78 | +++ b/block/file-posix.c | 19 | --- /dev/null |
79 | @@ -XXX,XX +XXX,XX @@ static int handle_aiocb_discard(void *opaque) | 20 | +++ b/tests/qemu-iotests/263 |
80 | return ret; | 21 | @@ -XXX,XX +XXX,XX @@ |
81 | } | 22 | +#!/usr/bin/env bash |
82 | 23 | +# | |
83 | +/* | 24 | +# Test encrypted write that crosses cluster boundary of two unallocated clusters |
84 | + * Help alignment probing by allocating the first block. | 25 | +# Based on 188 |
85 | + * | 26 | +# |
86 | + * When reading with direct I/O from unallocated area on Gluster backed by XFS, | 27 | +# Copyright (C) 2019 Red Hat, Inc. |
87 | + * reading succeeds regardless of request length. In this case we fallback to | 28 | +# |
88 | + * safe alignment which is not optimal. Allocating the first block avoids this | 29 | +# This program is free software; you can redistribute it and/or modify |
89 | + * fallback. | 30 | +# it under the terms of the GNU General Public License as published by |
90 | + * | 31 | +# the Free Software Foundation; either version 2 of the License, or |
91 | + * fd may be opened with O_DIRECT, but we don't know the buffer alignment or | 32 | +# (at your option) any later version. |
92 | + * request alignment, so we use safe values. | 33 | +# |
93 | + * | 34 | +# This program is distributed in the hope that it will be useful, |
94 | + * Returns: 0 on success, -errno on failure. Since this is an optimization, | 35 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
95 | + * caller may ignore failures. | 36 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
96 | + */ | 37 | +# GNU General Public License for more details. |
97 | +static int allocate_first_block(int fd, size_t max_size) | 38 | +# |
39 | +# You should have received a copy of the GNU General Public License | ||
40 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
41 | +# | ||
42 | + | ||
43 | +# creator | ||
44 | +owner=mlevitsk@redhat.com | ||
45 | + | ||
46 | +seq=`basename $0` | ||
47 | +echo "QA output created by $seq" | ||
48 | + | ||
49 | +status=1 # failure is the default! | ||
50 | + | ||
51 | +_cleanup() | ||
98 | +{ | 52 | +{ |
99 | + size_t write_size = (max_size < MAX_BLOCKSIZE) | 53 | + _cleanup_test_img |
100 | + ? BDRV_SECTOR_SIZE | 54 | +} |
101 | + : MAX_BLOCKSIZE; | 55 | +trap "_cleanup; exit \$status" 0 1 2 3 15 |
102 | + size_t max_align = MAX(MAX_BLOCKSIZE, getpagesize()); | ||
103 | + void *buf; | ||
104 | + ssize_t n; | ||
105 | + int ret; | ||
106 | + | 56 | + |
107 | + buf = qemu_memalign(max_align, write_size); | 57 | +# get standard environment, filters and checks |
108 | + memset(buf, 0, write_size); | 58 | +. ./common.rc |
59 | +. ./common.filter | ||
109 | + | 60 | + |
110 | + do { | 61 | +_supported_fmt qcow2 |
111 | + n = pwrite(fd, buf, write_size, 0); | 62 | +_supported_proto generic |
112 | + } while (n == -1 && errno == EINTR); | 63 | +_supported_os Linux |
113 | + | 64 | + |
114 | + ret = (n == -1) ? -errno : 0; | ||
115 | + | 65 | + |
116 | + qemu_vfree(buf); | 66 | +size=1M |
117 | + return ret; | 67 | + |
68 | +SECRET="secret,id=sec0,data=astrochicken" | ||
69 | +QEMU_IO_OPTIONS=$QEMU_IO_OPTIONS_NO_FMT | ||
70 | + | ||
71 | + | ||
72 | +_run_test() | ||
73 | +{ | ||
74 | + echo "== reading the whole image ==" | ||
75 | + $QEMU_IO --object $SECRET -c "read -P 0 0 $size" --image-opts "$1" | _filter_qemu_io | _filter_testdir | ||
76 | + | ||
77 | + echo | ||
78 | + echo "== write two 512 byte sectors on a cluster boundary ==" | ||
79 | + $QEMU_IO --object $SECRET -c "write -P 0xAA 0xFE00 0x400" --image-opts "$1" | _filter_qemu_io | _filter_testdir | ||
80 | + | ||
81 | + echo | ||
82 | + echo "== verify that the rest of the image is not changed ==" | ||
83 | + $QEMU_IO --object $SECRET -c "read -P 0x00 0x00000 0xFE00" --image-opts "$1" | _filter_qemu_io | _filter_testdir | ||
84 | + $QEMU_IO --object $SECRET -c "read -P 0xAA 0x0FE00 0x400" --image-opts "$1" | _filter_qemu_io | _filter_testdir | ||
85 | + $QEMU_IO --object $SECRET -c "read -P 0x00 0x10200 0xEFE00" --image-opts "$1" | _filter_qemu_io | _filter_testdir | ||
86 | + | ||
118 | +} | 87 | +} |
119 | + | 88 | + |
120 | static int handle_aiocb_truncate(void *opaque) | 89 | + |
121 | { | 90 | +echo |
122 | RawPosixAIOData *aiocb = opaque; | 91 | +echo "testing LUKS qcow2 encryption" |
123 | @@ -XXX,XX +XXX,XX @@ static int handle_aiocb_truncate(void *opaque) | 92 | +echo |
124 | /* posix_fallocate() doesn't set errno. */ | 93 | + |
125 | error_setg_errno(errp, -result, | 94 | +_make_test_img --object $SECRET -o "encrypt.format=luks,encrypt.key-secret=sec0,encrypt.iter-time=10,cluster_size=64K" $size |
126 | "Could not preallocate new data"); | 95 | +_run_test "driver=$IMGFMT,encrypt.key-secret=sec0,file.filename=$TEST_IMG" |
127 | + } else if (current_length == 0) { | 96 | +_cleanup_test_img |
128 | + /* | 97 | + |
129 | + * posix_fallocate() uses fallocate() if the filesystem | 98 | +echo |
130 | + * supports it, or fallback to manually writing zeroes. If | 99 | +echo "testing legacy AES qcow2 encryption" |
131 | + * fallocate() was used, unaligned reads from the fallocated | 100 | +echo |
132 | + * area in raw_probe_alignment() will succeed, hence we need to | 101 | + |
133 | + * allocate the first block. | 102 | + |
134 | + * | 103 | +_make_test_img --object $SECRET -o "encrypt.format=aes,encrypt.key-secret=sec0,cluster_size=64K" $size |
135 | + * Optimize future alignment probing; ignore failures. | 104 | +_run_test "driver=$IMGFMT,encrypt.key-secret=sec0,file.filename=$TEST_IMG" |
136 | + */ | 105 | +_cleanup_test_img |
137 | + allocate_first_block(fd, offset); | 106 | + |
138 | } | 107 | + |
139 | } else { | 108 | + |
140 | result = 0; | 109 | +# success, all done |
141 | @@ -XXX,XX +XXX,XX @@ static int handle_aiocb_truncate(void *opaque) | 110 | +echo "*** done" |
142 | if (ftruncate(fd, offset) != 0) { | 111 | +rm -f $seq.full |
143 | result = -errno; | 112 | +status=0 |
144 | error_setg_errno(errp, -result, "Could not resize file"); | 113 | diff --git a/tests/qemu-iotests/263.out b/tests/qemu-iotests/263.out |
145 | + } else if (current_length == 0 && offset > current_length) { | ||
146 | + /* Optimize future alignment probing; ignore failures. */ | ||
147 | + allocate_first_block(fd, offset); | ||
148 | } | ||
149 | return result; | ||
150 | default: | ||
151 | diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out | ||
152 | index XXXXXXX..XXXXXXX 100644 | ||
153 | --- a/tests/qemu-iotests/059.out | ||
154 | +++ b/tests/qemu-iotests/059.out | ||
155 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824000 subformat=twoGbMax | ||
156 | image: TEST_DIR/t.vmdk | ||
157 | file format: vmdk | ||
158 | virtual size: 0.977 TiB (1073741824000 bytes) | ||
159 | -disk size: 16 KiB | ||
160 | +disk size: 1.97 MiB | ||
161 | Format specific information: | ||
162 | cid: XXXXXXXX | ||
163 | parent cid: XXXXXXXX | ||
164 | diff --git a/tests/qemu-iotests/150.out b/tests/qemu-iotests/150.out.qcow2 | ||
165 | similarity index 100% | ||
166 | rename from tests/qemu-iotests/150.out | ||
167 | rename to tests/qemu-iotests/150.out.qcow2 | ||
168 | diff --git a/tests/qemu-iotests/150.out.raw b/tests/qemu-iotests/150.out.raw | ||
169 | new file mode 100644 | 114 | new file mode 100644 |
170 | index XXXXXXX..XXXXXXX | 115 | index XXXXXXX..XXXXXXX |
171 | --- /dev/null | 116 | --- /dev/null |
172 | +++ b/tests/qemu-iotests/150.out.raw | 117 | +++ b/tests/qemu-iotests/263.out |
173 | @@ -XXX,XX +XXX,XX @@ | 118 | @@ -XXX,XX +XXX,XX @@ |
174 | +QA output created by 150 | 119 | +QA output created by 263 |
175 | + | 120 | + |
176 | +=== Mapping sparse conversion === | 121 | +testing LUKS qcow2 encryption |
177 | + | 122 | + |
178 | +Offset Length File | 123 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 encrypt.format=luks encrypt.key-secret=sec0 encrypt.iter-time=10 |
179 | +0 0x1000 TEST_DIR/t.IMGFMT | 124 | +== reading the whole image == |
125 | +read 1048576/1048576 bytes at offset 0 | ||
126 | +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
180 | + | 127 | + |
181 | +=== Mapping non-sparse conversion === | 128 | +== write two 512 byte sectors on a cluster boundary == |
129 | +wrote 1024/1024 bytes at offset 65024 | ||
130 | +1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
182 | + | 131 | + |
183 | +Offset Length File | 132 | +== verify that the rest of the image is not changed == |
184 | +0 0x100000 TEST_DIR/t.IMGFMT | 133 | +read 65024/65024 bytes at offset 0 |
134 | +63.500 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
135 | +read 1024/1024 bytes at offset 65024 | ||
136 | +1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
137 | +read 982528/982528 bytes at offset 66048 | ||
138 | +959.500 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
139 | + | ||
140 | +testing legacy AES qcow2 encryption | ||
141 | + | ||
142 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 encrypt.format=aes encrypt.key-secret=sec0 | ||
143 | +== reading the whole image == | ||
144 | +read 1048576/1048576 bytes at offset 0 | ||
145 | +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
146 | + | ||
147 | +== write two 512 byte sectors on a cluster boundary == | ||
148 | +wrote 1024/1024 bytes at offset 65024 | ||
149 | +1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
150 | + | ||
151 | +== verify that the rest of the image is not changed == | ||
152 | +read 65024/65024 bytes at offset 0 | ||
153 | +63.500 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
154 | +read 1024/1024 bytes at offset 65024 | ||
155 | +1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
156 | +read 982528/982528 bytes at offset 66048 | ||
157 | +959.500 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
185 | +*** done | 158 | +*** done |
186 | diff --git a/tests/qemu-iotests/175 b/tests/qemu-iotests/175 | 159 | diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group |
187 | index XXXXXXX..XXXXXXX 100755 | ||
188 | --- a/tests/qemu-iotests/175 | ||
189 | +++ b/tests/qemu-iotests/175 | ||
190 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
191 | # the file size. This function hides the resulting difference in the | ||
192 | # stat -c '%b' output. | ||
193 | # Parameter 1: Number of blocks an empty file occupies | ||
194 | -# Parameter 2: Image size in bytes | ||
195 | +# Parameter 2: Minimal number of blocks in an image | ||
196 | +# Parameter 3: Image size in bytes | ||
197 | _filter_blocks() | ||
198 | { | ||
199 | extra_blocks=$1 | ||
200 | - img_size=$2 | ||
201 | + min_blocks=$2 | ||
202 | + img_size=$3 | ||
203 | |||
204 | - sed -e "s/blocks=$extra_blocks\\(\$\\|[^0-9]\\)/nothing allocated/" \ | ||
205 | - -e "s/blocks=$((extra_blocks + img_size / 512))\\(\$\\|[^0-9]\\)/everything allocated/" | ||
206 | + sed -e "s/blocks=$min_blocks\\(\$\\|[^0-9]\\)/min allocation/" \ | ||
207 | + -e "s/blocks=$((extra_blocks + img_size / 512))\\(\$\\|[^0-9]\\)/max allocation/" | ||
208 | } | ||
209 | |||
210 | # get standard environment, filters and checks | ||
211 | @@ -XXX,XX +XXX,XX @@ size=$((1 * 1024 * 1024)) | ||
212 | touch "$TEST_DIR/empty" | ||
213 | extra_blocks=$(stat -c '%b' "$TEST_DIR/empty") | ||
214 | |||
215 | +# We always write the first byte; check how many blocks this filesystem | ||
216 | +# allocates to match empty image alloation. | ||
217 | +printf "\0" > "$TEST_DIR/empty" | ||
218 | +min_blocks=$(stat -c '%b' "$TEST_DIR/empty") | ||
219 | + | ||
220 | echo | ||
221 | echo "== creating image with default preallocation ==" | ||
222 | _make_test_img $size | _filter_imgfmt | ||
223 | -stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $size | ||
224 | +stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $min_blocks $size | ||
225 | |||
226 | for mode in off full falloc; do | ||
227 | echo | ||
228 | echo "== creating image with preallocation $mode ==" | ||
229 | IMGOPTS=preallocation=$mode _make_test_img $size | _filter_imgfmt | ||
230 | - stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $size | ||
231 | + stat -c "size=%s, blocks=%b" $TEST_IMG | _filter_blocks $extra_blocks $min_blocks $size | ||
232 | done | ||
233 | |||
234 | # success, all done | ||
235 | diff --git a/tests/qemu-iotests/175.out b/tests/qemu-iotests/175.out | ||
236 | index XXXXXXX..XXXXXXX 100644 | 160 | index XXXXXXX..XXXXXXX 100644 |
237 | --- a/tests/qemu-iotests/175.out | 161 | --- a/tests/qemu-iotests/group |
238 | +++ b/tests/qemu-iotests/175.out | 162 | +++ b/tests/qemu-iotests/group |
239 | @@ -XXX,XX +XXX,XX @@ QA output created by 175 | 163 | @@ -XXX,XX +XXX,XX @@ |
240 | 164 | 257 rw | |
241 | == creating image with default preallocation == | 165 | 258 rw quick |
242 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 | 166 | 262 rw quick migration |
243 | -size=1048576, nothing allocated | 167 | +263 rw quick |
244 | +size=1048576, min allocation | 168 | 265 rw auto quick |
245 | 169 | 266 rw quick | |
246 | == creating image with preallocation off == | ||
247 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=off | ||
248 | -size=1048576, nothing allocated | ||
249 | +size=1048576, min allocation | ||
250 | |||
251 | == creating image with preallocation full == | ||
252 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=full | ||
253 | -size=1048576, everything allocated | ||
254 | +size=1048576, max allocation | ||
255 | |||
256 | == creating image with preallocation falloc == | ||
257 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 preallocation=falloc | ||
258 | -size=1048576, everything allocated | ||
259 | +size=1048576, max allocation | ||
260 | *** done | ||
261 | diff --git a/tests/qemu-iotests/178.out.qcow2 b/tests/qemu-iotests/178.out.qcow2 | ||
262 | index XXXXXXX..XXXXXXX 100644 | ||
263 | --- a/tests/qemu-iotests/178.out.qcow2 | ||
264 | +++ b/tests/qemu-iotests/178.out.qcow2 | ||
265 | @@ -XXX,XX +XXX,XX @@ converted image file size in bytes: 196608 | ||
266 | == raw input image with data (human) == | ||
267 | |||
268 | Formatting 'TEST_DIR/t.qcow2', fmt=IMGFMT size=1073741824 | ||
269 | -required size: 393216 | ||
270 | +required size: 458752 | ||
271 | fully allocated size: 1074135040 | ||
272 | wrote 512/512 bytes at offset 512 | ||
273 | 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
274 | @@ -XXX,XX +XXX,XX @@ converted image file size in bytes: 196608 | ||
275 | |||
276 | Formatting 'TEST_DIR/t.qcow2', fmt=IMGFMT size=1073741824 | ||
277 | { | ||
278 | - "required": 393216, | ||
279 | + "required": 458752, | ||
280 | "fully-allocated": 1074135040 | ||
281 | } | ||
282 | wrote 512/512 bytes at offset 512 | ||
283 | diff --git a/tests/qemu-iotests/221.out b/tests/qemu-iotests/221.out | ||
284 | index XXXXXXX..XXXXXXX 100644 | ||
285 | --- a/tests/qemu-iotests/221.out | ||
286 | +++ b/tests/qemu-iotests/221.out | ||
287 | @@ -XXX,XX +XXX,XX @@ QA output created by 221 | ||
288 | === Check mapping of unaligned raw image === | ||
289 | |||
290 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=65537 | ||
291 | -[{ "start": 0, "length": 66048, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] | ||
292 | -[{ "start": 0, "length": 66048, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] | ||
293 | +[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, | ||
294 | +{ "start": 4096, "length": 61952, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] | ||
295 | +[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, | ||
296 | +{ "start": 4096, "length": 61952, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] | ||
297 | wrote 1/1 bytes at offset 65536 | ||
298 | 1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
299 | -[{ "start": 0, "length": 65536, "depth": 0, "zero": true, "data": false, "offset": OFFSET}, | ||
300 | +[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, | ||
301 | +{ "start": 4096, "length": 61440, "depth": 0, "zero": true, "data": false, "offset": OFFSET}, | ||
302 | { "start": 65536, "length": 1, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, | ||
303 | { "start": 65537, "length": 511, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] | ||
304 | -[{ "start": 0, "length": 65536, "depth": 0, "zero": true, "data": false, "offset": OFFSET}, | ||
305 | +[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, | ||
306 | +{ "start": 4096, "length": 61440, "depth": 0, "zero": true, "data": false, "offset": OFFSET}, | ||
307 | { "start": 65536, "length": 1, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, | ||
308 | { "start": 65537, "length": 511, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] | ||
309 | *** done | ||
310 | diff --git a/tests/qemu-iotests/253.out b/tests/qemu-iotests/253.out | ||
311 | index XXXXXXX..XXXXXXX 100644 | ||
312 | --- a/tests/qemu-iotests/253.out | ||
313 | +++ b/tests/qemu-iotests/253.out | ||
314 | @@ -XXX,XX +XXX,XX @@ QA output created by 253 | ||
315 | === Check mapping of unaligned raw image === | ||
316 | |||
317 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048575 | ||
318 | -[{ "start": 0, "length": 1048576, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] | ||
319 | -[{ "start": 0, "length": 1048576, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] | ||
320 | +[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, | ||
321 | +{ "start": 4096, "length": 1044480, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] | ||
322 | +[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, | ||
323 | +{ "start": 4096, "length": 1044480, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] | ||
324 | wrote 65535/65535 bytes at offset 983040 | ||
325 | 63.999 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
326 | -[{ "start": 0, "length": 983040, "depth": 0, "zero": true, "data": false, "offset": OFFSET}, | ||
327 | +[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, | ||
328 | +{ "start": 4096, "length": 978944, "depth": 0, "zero": true, "data": false, "offset": OFFSET}, | ||
329 | { "start": 983040, "length": 65536, "depth": 0, "zero": false, "data": true, "offset": OFFSET}] | ||
330 | -[{ "start": 0, "length": 983040, "depth": 0, "zero": true, "data": false, "offset": OFFSET}, | ||
331 | +[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": OFFSET}, | ||
332 | +{ "start": 4096, "length": 978944, "depth": 0, "zero": true, "data": false, "offset": OFFSET}, | ||
333 | { "start": 983040, "length": 65536, "depth": 0, "zero": false, "data": true, "offset": OFFSET}] | ||
334 | *** done | ||
335 | -- | 170 | -- |
336 | 2.21.0 | 171 | 2.21.0 |
337 | 172 | ||
338 | 173 | diff view generated by jsdifflib |