1 | The following changes since commit dd25f97c66a75d1508f1d4c6478ed2c95bec428f: | 1 | The following changes since commit ed8ad9728a9c0eec34db9dff61dfa2f1dd625637: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20190913' into staging (2019-09-16 10:15:15 +0100) | 3 | Merge tag 'pull-tpm-2023-07-14-1' of https://github.com/stefanberger/qemu-tpm into staging (2023-07-15 14:54:04 +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-09-16 | 7 | https://gitlab.com/stefanha/qemu.git tags/block-pull-request |
8 | 8 | ||
9 | for you to fetch changes up to 1825cc0783ccf0ec5d9f0b225a99b340bdd4c68f: | 9 | for you to fetch changes up to 66547f416a61e0cb711dc76821890242432ba193: |
10 | 10 | ||
11 | qemu-iotests: Add test for bz #1745922 (2019-09-16 15:37:12 +0200) | 11 | block/nvme: invoke blk_io_plug_call() outside q->lock (2023-07-17 09:17:41 -0400) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Block patches: | 14 | Pull request |
15 | - Fix for block jobs when used with I/O threads | 15 | |
16 | - Fix for a corruption when using qcow2's LUKS encryption mode | 16 | Fix the hang in the nvme:// block driver during startup. |
17 | - cURL fix | ||
18 | - check-block.sh cleanups (for make check) | ||
19 | - Refactoring | ||
20 | 17 | ||
21 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
22 | Max Reitz (7): | ||
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 | ||
30 | 19 | ||
31 | Maxim Levitsky (3): | 20 | Stefan Hajnoczi (1): |
32 | block/qcow2: Fix corruption introduced by commit 8ac0f15f335 | 21 | block/nvme: invoke blk_io_plug_call() outside q->lock |
33 | block/qcow2: refactor encryption code | ||
34 | qemu-iotests: Add test for bz #1745922 | ||
35 | 22 | ||
36 | Nir Soffer (2): | 23 | block/nvme.c | 3 ++- |
37 | block: Use QEMU_IS_ALIGNED | 24 | 1 file changed, 2 insertions(+), 1 deletion(-) |
38 | block: Remove unused masks | ||
39 | |||
40 | Sergio Lopez (1): | ||
41 | blockjob: update nodes head while removing all bdrv | ||
42 | |||
43 | Thomas Huth (2): | ||
44 | tests/qemu-iotests/check: Replace "tests" with "iotests" in final | ||
45 | status text | ||
46 | tests/Makefile: Do not print the name of the check-block.sh shell | ||
47 | script | ||
48 | |||
49 | Vladimir Sementsov-Ogievskiy (1): | ||
50 | tests/qemu-iotests: Fix qemu-io related output in 026.out.nocache | ||
51 | |||
52 | tests/Makefile.include | 2 +- | ||
53 | block/qcow2.h | 8 +- | ||
54 | include/block/block.h | 2 - | ||
55 | block/bochs.c | 4 +- | ||
56 | block/cloop.c | 4 +- | ||
57 | block/curl.c | 133 ++++++++++------------- | ||
58 | block/dmg.c | 4 +- | ||
59 | block/io.c | 8 +- | ||
60 | block/qcow2-cluster.c | 40 +++---- | ||
61 | block/qcow2-threads.c | 63 ++++++++--- | ||
62 | block/qcow2.c | 9 +- | ||
63 | block/vvfat.c | 8 +- | ||
64 | blockjob.c | 17 ++- | ||
65 | migration/block.c | 2 +- | ||
66 | qemu-img.c | 2 +- | ||
67 | tests/qemu-iotests/026.out.nocache | 168 ++++++++++++++--------------- | ||
68 | tests/qemu-iotests/263 | 91 ++++++++++++++++ | ||
69 | tests/qemu-iotests/263.out | 40 +++++++ | ||
70 | tests/qemu-iotests/check | 8 +- | ||
71 | tests/qemu-iotests/group | 1 + | ||
72 | 20 files changed, 380 insertions(+), 234 deletions(-) | ||
73 | create mode 100755 tests/qemu-iotests/263 | ||
74 | create mode 100644 tests/qemu-iotests/263.out | ||
75 | 25 | ||
76 | -- | 26 | -- |
77 | 2.21.0 | 27 | 2.40.1 |
78 | |||
79 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Nir Soffer <nirsof@gmail.com> | ||
2 | 1 | ||
3 | Replace instances of: | ||
4 | |||
5 | (n & (BDRV_SECTOR_SIZE - 1)) == 0 | ||
6 | |||
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. | ||
17 | |||
18 | Signed-off-by: Nir Soffer <nsoffer@redhat.com> | ||
19 | Message-id: 20190827185913.27427-2-nsoffer@redhat.com | ||
20 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
21 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
22 | --- | ||
23 | block/bochs.c | 4 ++-- | ||
24 | block/cloop.c | 4 ++-- | ||
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(-) | ||
32 | |||
33 | diff --git a/block/bochs.c b/block/bochs.c | ||
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/block/bochs.c | ||
36 | +++ b/block/bochs.c | ||
37 | @@ -XXX,XX +XXX,XX @@ bochs_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, | ||
38 | QEMUIOVector local_qiov; | ||
39 | int ret; | ||
40 | |||
41 | - assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); | ||
42 | - assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); | ||
43 | + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); | ||
44 | + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); | ||
45 | |||
46 | qemu_iovec_init(&local_qiov, qiov->niov); | ||
47 | qemu_co_mutex_lock(&s->lock); | ||
48 | diff --git a/block/cloop.c b/block/cloop.c | ||
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 " | ||
173 | -- | ||
174 | 2.21.0 | ||
175 | |||
176 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Nir Soffer <nirsof@gmail.com> | ||
2 | 1 | ||
3 | Replace confusing usage: | ||
4 | |||
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 | |||
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> | ||
18 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
19 | --- | ||
20 | include/block/block.h | 2 -- | ||
21 | migration/block.c | 2 +- | ||
22 | 2 files changed, 1 insertion(+), 3 deletions(-) | ||
23 | |||
24 | diff --git a/include/block/block.h b/include/block/block.h | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/include/block/block.h | ||
27 | +++ b/include/block/block.h | ||
28 | @@ -XXX,XX +XXX,XX @@ typedef struct HDGeometry { | ||
29 | |||
30 | #define BDRV_SECTOR_BITS 9 | ||
31 | #define BDRV_SECTOR_SIZE (1ULL << BDRV_SECTOR_BITS) | ||
32 | -#define BDRV_SECTOR_MASK ~(BDRV_SECTOR_SIZE - 1) | ||
33 | |||
34 | #define BDRV_REQUEST_MAX_SECTORS MIN(SIZE_MAX >> BDRV_SECTOR_BITS, \ | ||
35 | INT_MAX >> BDRV_SECTOR_BITS) | ||
36 | @@ -XXX,XX +XXX,XX @@ typedef struct HDGeometry { | ||
37 | #define BDRV_BLOCK_ALLOCATED 0x10 | ||
38 | #define BDRV_BLOCK_EOF 0x20 | ||
39 | #define BDRV_BLOCK_RECURSE 0x40 | ||
40 | -#define BDRV_BLOCK_OFFSET_MASK BDRV_SECTOR_MASK | ||
41 | |||
42 | typedef QSIMPLEQ_HEAD(BlockReopenQueue, BlockReopenQueueEntry) BlockReopenQueue; | ||
43 | |||
44 | diff --git a/migration/block.c b/migration/block.c | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/migration/block.c | ||
47 | +++ b/migration/block.c | ||
48 | @@ -XXX,XX +XXX,XX @@ static int block_load(QEMUFile *f, void *opaque, int version_id) | ||
49 | do { | ||
50 | addr = qemu_get_be64(f); | ||
51 | |||
52 | - flags = addr & ~BDRV_SECTOR_MASK; | ||
53 | + flags = addr & (BDRV_SECTOR_SIZE - 1); | ||
54 | addr >>= BDRV_SECTOR_BITS; | ||
55 | |||
56 | if (flags & BLK_MIG_FLAG_DEVICE_BLOCK) { | ||
57 | -- | ||
58 | 2.21.0 | ||
59 | |||
60 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Thomas Huth <thuth@redhat.com> | ||
2 | 1 | ||
3 | When running "make check -j8" or something similar, the iotests are | ||
4 | running in parallel with the other tests. So when they are printing | ||
5 | out "Passed all xx tests" or a similar status message at the end, | ||
6 | it might not be quite clear that this message belongs to the iotests, | ||
7 | since the output might be mixed with the other tests. Thus change the | ||
8 | word "tests" here to "iotests" instead to avoid confusion. | ||
9 | |||
10 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
11 | Message-id: 20190906113920.11271-1-thuth@redhat.com | ||
12 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
13 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
14 | --- | ||
15 | tests/qemu-iotests/check | 8 ++++---- | ||
16 | 1 file changed, 4 insertions(+), 4 deletions(-) | ||
17 | |||
18 | diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check | ||
19 | index XXXXXXX..XXXXXXX 100755 | ||
20 | --- a/tests/qemu-iotests/check | ||
21 | +++ b/tests/qemu-iotests/check | ||
22 | @@ -XXX,XX +XXX,XX @@ END { if (NR > 0) { | ||
23 | if [ ! -z "$n_bad" -a $n_bad != 0 ] | ||
24 | then | ||
25 | echo "Failures:$bad" | ||
26 | - echo "Failed $n_bad of $try tests" | ||
27 | + echo "Failed $n_bad of $try iotests" | ||
28 | echo "Failures:$bad" | fmt >>check.log | ||
29 | - echo "Failed $n_bad of $try tests" >>check.log | ||
30 | + echo "Failed $n_bad of $try iotests" >>check.log | ||
31 | else | ||
32 | - echo "Passed all $try tests" | ||
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 | ||
39 | -- | ||
40 | 2.21.0 | ||
41 | |||
42 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Thomas Huth <thuth@redhat.com> | ||
2 | 1 | ||
3 | The check script is already printing out which iotest is currently | ||
4 | running, so printing out the name of the check-block.sh shell script | ||
5 | looks superfluous here. | ||
6 | |||
7 | Signed-off-by: Thomas Huth <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> | ||
11 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
12 | --- | ||
13 | tests/Makefile.include | 2 +- | ||
14 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/tests/Makefile.include b/tests/Makefile.include | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/tests/Makefile.include | ||
19 | +++ b/tests/Makefile.include | ||
20 | @@ -XXX,XX +XXX,XX @@ QEMU_IOTESTS_HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = tests/qemu | ||
21 | check-tests/check-block.sh: tests/check-block.sh qemu-img$(EXESUF) \ | ||
22 | qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \ | ||
23 | $(patsubst %,%/all,$(filter %-softmmu,$(TARGET_DIRS))) | ||
24 | - $< | ||
25 | + @$< | ||
26 | |||
27 | .PHONY: $(patsubst %, check-%, $(check-qapi-schema-y)) | ||
28 | $(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/%.json | ||
29 | -- | ||
30 | 2.21.0 | ||
31 | |||
32 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
2 | 1 | ||
3 | qemu-io now prefixes its error and warnings with "qemu-io:". | ||
4 | 36b9986b08787019e fixed a lot of iotests output but forget about | ||
5 | 026.out.nocache. Fix it too. | ||
6 | |||
7 | Fixes: 99e98d7c9fc1a1639fad ("qemu-io: Use error_[gs]et_progname()") | ||
8 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
9 | Message-id: 20190816153015.447957-2-vsementsov@virtuozzo.com | ||
10 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
11 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
12 | --- | ||
13 | tests/qemu-iotests/026.out.nocache | 168 ++++++++++++++--------------- | ||
14 | 1 file changed, 84 insertions(+), 84 deletions(-) | ||
15 | |||
16 | diff --git a/tests/qemu-iotests/026.out.nocache b/tests/qemu-iotests/026.out.nocache | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/tests/qemu-iotests/026.out.nocache | ||
19 | +++ b/tests/qemu-iotests/026.out.nocache | ||
20 | @@ -XXX,XX +XXX,XX @@ No errors were found on the image. | ||
21 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
22 | |||
23 | Event: l1_update; errno: 5; imm: off; once: off; write | ||
24 | -Failed to flush the L2 table cache: Input/output error | ||
25 | -Failed to flush the refcount block cache: Input/output error | ||
26 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
27 | +qemu-io: Failed to flush the refcount block cache: Input/output error | ||
28 | write failed: Input/output error | ||
29 | |||
30 | 1 leaked clusters were found on the image. | ||
31 | @@ -XXX,XX +XXX,XX @@ This means waste of disk space, but no harm to data. | ||
32 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 | ||
33 | |||
34 | Event: l1_update; errno: 5; imm: off; once: off; write -b | ||
35 | -Failed to flush the L2 table cache: Input/output error | ||
36 | -Failed to flush the refcount block cache: Input/output error | ||
37 | +qemu-io: Failed to flush the L2 table cache: Input/output error | ||
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. | ||
460 | -- | ||
461 | 2.21.0 | ||
462 | |||
463 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | A follow-up patch will make curl_multi_do() and curl_multi_read() take a | ||
2 | CURLSocket instead of the CURLState. They still need the latter, | ||
3 | though, so add a pointer to it to the former. | ||
4 | 1 | ||
5 | Cc: qemu-stable@nongnu.org | ||
6 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
7 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
8 | Message-id: 20190910124136.10565-2-mreitz@redhat.com | ||
9 | Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> | ||
10 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
11 | --- | ||
12 | block/curl.c | 3 +++ | ||
13 | 1 file changed, 3 insertions(+) | ||
14 | |||
15 | diff --git a/block/curl.c b/block/curl.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/block/curl.c | ||
18 | +++ b/block/curl.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static CURLMcode __curl_multi_socket_action(CURLM *multi_handle, | ||
20 | #define CURL_BLOCK_OPT_TIMEOUT_DEFAULT 5 | ||
21 | |||
22 | struct BDRVCURLState; | ||
23 | +struct CURLState; | ||
24 | |||
25 | static bool libcurl_initialized; | ||
26 | |||
27 | @@ -XXX,XX +XXX,XX @@ typedef struct CURLAIOCB { | ||
28 | |||
29 | typedef struct CURLSocket { | ||
30 | int fd; | ||
31 | + struct CURLState *state; | ||
32 | QLIST_ENTRY(CURLSocket) next; | ||
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; | ||
43 | -- | ||
44 | 2.21.0 | ||
45 | |||
46 | diff view generated by jsdifflib |
1 | This does not really change anything, but it makes the code a bit easier | 1 | blk_io_plug_call() is invoked outside a blk_io_plug()/blk_io_unplug() |
---|---|---|---|
2 | to follow once we use @socket as the opaque pointer for | 2 | section while opening the NVMe drive from: |
3 | aio_set_fd_handler(). | ||
4 | 3 | ||
5 | Cc: qemu-stable@nongnu.org | 4 | nvme_file_open() -> |
6 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 5 | nvme_init() -> |
7 | Message-id: 20190910124136.10565-3-mreitz@redhat.com | 6 | nvme_identify() -> |
8 | Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> | 7 | nvme_admin_cmd_sync() -> |
9 | Reviewed-by: John Snow <jsnow@redhat.com> | 8 | nvme_submit_command() -> |
10 | Signed-off-by: Max Reitz <mreitz@redhat.com> | 9 | blk_io_plug_call() |
10 | |||
11 | blk_io_plug_call() immediately invokes the given callback when the | ||
12 | current thread is not plugged, as is the case during nvme_file_open(). | ||
13 | |||
14 | Unfortunately, nvme_submit_command() calls blk_io_plug_call() with | ||
15 | q->lock still held: | ||
16 | |||
17 | ... | ||
18 | q->sq.tail = (q->sq.tail + 1) % NVME_QUEUE_SIZE; | ||
19 | q->need_kick++; | ||
20 | blk_io_plug_call(nvme_unplug_fn, q); | ||
21 | qemu_mutex_unlock(&q->lock); | ||
22 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
23 | |||
24 | nvme_unplug_fn() deadlocks trying to acquire q->lock because the lock is | ||
25 | already acquired by the same thread. The symptom is that QEMU hangs | ||
26 | during startup while opening the NVMe drive. | ||
27 | |||
28 | Fix this by moving the blk_io_plug_call() outside q->lock. This is safe | ||
29 | because no other thread runs code related to this queue and | ||
30 | blk_io_plug_call()'s internal state is immune to thread safety issues | ||
31 | since it is thread-local. | ||
32 | |||
33 | Reported-by: Lukáš Doktor <ldoktor@redhat.com> | ||
34 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
35 | Tested-by: Lukas Doktor <ldoktor@redhat.com> | ||
36 | Message-id: 20230712191628.252806-1-stefanha@redhat.com | ||
37 | Fixes: f2e590002bd6 ("block/nvme: convert to blk_io_plug_call() API") | ||
38 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
11 | --- | 39 | --- |
12 | block/curl.c | 10 +++++----- | 40 | block/nvme.c | 3 ++- |
13 | 1 file changed, 5 insertions(+), 5 deletions(-) | 41 | 1 file changed, 2 insertions(+), 1 deletion(-) |
14 | 42 | ||
15 | diff --git a/block/curl.c b/block/curl.c | 43 | diff --git a/block/nvme.c b/block/nvme.c |
16 | index XXXXXXX..XXXXXXX 100644 | 44 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/block/curl.c | 45 | --- a/block/nvme.c |
18 | +++ b/block/curl.c | 46 | +++ b/block/nvme.c |
19 | @@ -XXX,XX +XXX,XX @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action, | 47 | @@ -XXX,XX +XXX,XX @@ static void nvme_submit_command(NVMeQueuePair *q, NVMeRequest *req, |
20 | 48 | q->sq.tail * NVME_SQ_ENTRY_BYTES, cmd, sizeof(*cmd)); | |
21 | QLIST_FOREACH(socket, &state->sockets, next) { | 49 | q->sq.tail = (q->sq.tail + 1) % NVME_QUEUE_SIZE; |
22 | if (socket->fd == fd) { | 50 | q->need_kick++; |
23 | - if (action == CURL_POLL_REMOVE) { | 51 | + qemu_mutex_unlock(&q->lock); |
24 | - QLIST_REMOVE(socket, next); | ||
25 | - g_free(socket); | ||
26 | - } | ||
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 | + | 52 | + |
47 | return 0; | 53 | blk_io_plug_call(nvme_unplug_fn, q); |
54 | - qemu_mutex_unlock(&q->lock); | ||
48 | } | 55 | } |
49 | 56 | ||
57 | static void nvme_admin_cmd_sync_cb(void *opaque, int ret) | ||
50 | -- | 58 | -- |
51 | 2.21.0 | 59 | 2.40.1 |
52 | 60 | ||
53 | 61 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | While it is more likely that transfers complete after some file | ||
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 | 1 | ||
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. | ||
9 | |||
10 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
11 | Message-id: 20190910124136.10565-4-mreitz@redhat.com | ||
12 | Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> | ||
13 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
14 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
15 | --- | ||
16 | block/curl.c | 14 ++------------ | ||
17 | 1 file changed, 2 insertions(+), 12 deletions(-) | ||
18 | |||
19 | diff --git a/block/curl.c b/block/curl.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/block/curl.c | ||
22 | +++ b/block/curl.c | ||
23 | @@ -XXX,XX +XXX,XX @@ typedef struct BDRVCURLState { | ||
24 | |||
25 | static void curl_clean_state(CURLState *s); | ||
26 | static void curl_multi_do(void *arg); | ||
27 | -static void curl_multi_read(void *arg); | ||
28 | |||
29 | #ifdef NEED_CURL_TIMER_CALLBACK | ||
30 | /* Called from curl_multi_do_locked, with s->mutex held. */ | ||
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); | ||
65 | -- | ||
66 | 2.21.0 | ||
67 | |||
68 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | curl_multi_do_locked() currently marks all sockets as ready. That is | ||
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. | ||
6 | 1 | ||
7 | Cc: qemu-stable@nongnu.org | ||
8 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
9 | Message-id: 20190910124136.10565-5-mreitz@redhat.com | ||
10 | Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> | ||
11 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
12 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
13 | --- | ||
14 | block/curl.c | 20 +++++++++++--------- | ||
15 | 1 file changed, 11 insertions(+), 9 deletions(-) | ||
16 | |||
17 | diff --git a/block/curl.c b/block/curl.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/block/curl.c | ||
20 | +++ b/block/curl.c | ||
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) | ||
41 | } | ||
42 | |||
43 | /* Called with s->mutex held. */ | ||
44 | -static void curl_multi_do_locked(CURLState *s) | ||
45 | +static void curl_multi_do_locked(CURLSocket *ready_socket) | ||
46 | { | ||
47 | CURLSocket *socket, *next_socket; | ||
48 | + CURLState *s = ready_socket->state; | ||
49 | int running; | ||
50 | int r; | ||
51 | |||
52 | @@ -XXX,XX +XXX,XX @@ static void curl_multi_do_locked(CURLState *s) | ||
53 | |||
54 | static void curl_multi_do(void *arg) | ||
55 | { | ||
56 | - CURLState *s = (CURLState *)arg; | ||
57 | + CURLSocket *socket = arg; | ||
58 | + BDRVCURLState *s = socket->state->s; | ||
59 | |||
60 | - qemu_mutex_lock(&s->s->mutex); | ||
61 | - curl_multi_do_locked(s); | ||
62 | - curl_multi_check_completion(s->s); | ||
63 | - qemu_mutex_unlock(&s->s->mutex); | ||
64 | + qemu_mutex_lock(&s->mutex); | ||
65 | + curl_multi_do_locked(socket); | ||
66 | + curl_multi_check_completion(s); | ||
67 | + qemu_mutex_unlock(&s->mutex); | ||
68 | } | ||
69 | |||
70 | static void curl_multi_timeout_do(void *arg) | ||
71 | -- | ||
72 | 2.21.0 | ||
73 | |||
74 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
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. | ||
8 | 1 | ||
9 | Fixes: ff5ca1664af85b24a4180d595ea6873fd3deac57 | ||
10 | Cc: qemu-stable@nongnu.org | ||
11 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
12 | Message-id: 20190910124136.10565-6-mreitz@redhat.com | ||
13 | Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> | ||
14 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
15 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
16 | --- | ||
17 | block/curl.c | 17 ++++++----------- | ||
18 | 1 file changed, 6 insertions(+), 11 deletions(-) | ||
19 | |||
20 | diff --git a/block/curl.c b/block/curl.c | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/block/curl.c | ||
23 | +++ b/block/curl.c | ||
24 | @@ -XXX,XX +XXX,XX @@ static void curl_multi_check_completion(BDRVCURLState *s) | ||
25 | } | ||
26 | |||
27 | /* Called with s->mutex held. */ | ||
28 | -static void curl_multi_do_locked(CURLSocket *ready_socket) | ||
29 | +static void curl_multi_do_locked(CURLSocket *socket) | ||
30 | { | ||
31 | - CURLSocket *socket, *next_socket; | ||
32 | - CURLState *s = ready_socket->state; | ||
33 | + BDRVCURLState *s = socket->state->s; | ||
34 | int running; | ||
35 | int r; | ||
36 | |||
37 | - if (!s->s->multi) { | ||
38 | + if (!s->multi) { | ||
39 | return; | ||
40 | } | ||
41 | |||
42 | - /* Need to use _SAFE because curl_multi_socket_action() may trigger | ||
43 | - * curl_sock_cb() which might modify this list */ | ||
44 | - QLIST_FOREACH_SAFE(socket, &s->sockets, next, next_socket) { | ||
45 | - do { | ||
46 | - r = curl_multi_socket_action(s->s->multi, socket->fd, 0, &running); | ||
47 | - } while (r == CURLM_CALL_MULTI_PERFORM); | ||
48 | - } | ||
49 | + do { | ||
50 | + r = curl_multi_socket_action(s->multi, socket->fd, 0, &running); | ||
51 | + } while (r == CURLM_CALL_MULTI_PERFORM); | ||
52 | } | ||
53 | |||
54 | static void curl_multi_do(void *arg) | ||
55 | -- | ||
56 | 2.21.0 | ||
57 | |||
58 | diff view generated by jsdifflib |
Deleted 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(). | ||
4 | 1 | ||
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 |
Deleted patch | |||
---|---|---|---|
1 | If we had done that all along, debugging would have been much simpler. | ||
2 | (Also, I/O errors are better than hangs.) | ||
3 | 1 | ||
4 | Signed-off-by: Max Reitz <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> | ||
8 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
9 | --- | ||
10 | block/curl.c | 8 +++++++- | ||
11 | 1 file changed, 7 insertions(+), 1 deletion(-) | ||
12 | |||
13 | diff --git a/block/curl.c b/block/curl.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/block/curl.c | ||
16 | +++ b/block/curl.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static void curl_setup_preadv(BlockDriverState *bs, CURLAIOCB *acb) | ||
18 | trace_curl_setup_preadv(acb->bytes, start, state->range); | ||
19 | curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range); | ||
20 | |||
21 | - curl_multi_add_handle(s->multi, state->curl); | ||
22 | + if (curl_multi_add_handle(s->multi, state->curl) != CURLM_OK) { | ||
23 | + state->acb[0] = NULL; | ||
24 | + acb->ret = -EIO; | ||
25 | + | ||
26 | + curl_clean_state(state); | ||
27 | + goto out; | ||
28 | + } | ||
29 | |||
30 | /* Tell curl it needs to kick things off */ | ||
31 | curl_multi_socket_action(s->multi, CURL_SOCKET_TIMEOUT, 0, &running); | ||
32 | -- | ||
33 | 2.21.0 | ||
34 | |||
35 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Sergio Lopez <slp@redhat.com> | ||
2 | 1 | ||
3 | block_job_remove_all_bdrv() iterates through job->nodes, calling | ||
4 | bdrv_root_unref_child() for each entry. The call to the latter may | ||
5 | reach child_job_[can_]set_aio_ctx(), which will also attempt to | ||
6 | traverse job->nodes, potentially finding entries that where freed | ||
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> | ||
18 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
19 | --- | ||
20 | blockjob.c | 17 +++++++++++++---- | ||
21 | 1 file changed, 13 insertions(+), 4 deletions(-) | ||
22 | |||
23 | diff --git a/blockjob.c b/blockjob.c | ||
24 | index XXXXXXX..XXXXXXX 100644 | ||
25 | --- a/blockjob.c | ||
26 | +++ b/blockjob.c | ||
27 | @@ -XXX,XX +XXX,XX @@ static const BdrvChildRole child_job = { | ||
28 | |||
29 | void block_job_remove_all_bdrv(BlockJob *job) | ||
30 | { | ||
31 | - GSList *l; | ||
32 | - for (l = job->nodes; l; l = l->next) { | ||
33 | + /* | ||
34 | + * bdrv_root_unref_child() may reach child_job_[can_]set_aio_ctx(), | ||
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) | ||
55 | -- | ||
56 | 2.21.0 | ||
57 | |||
58 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Maxim Levitsky <mlevitsk@redhat.com> | ||
2 | 1 | ||
3 | This fixes subtle corruption introduced by luks threaded encryption | ||
4 | in commit 8ac0f15f335 | ||
5 | |||
6 | Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1745922 | ||
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> | ||
37 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
38 | --- | ||
39 | block/qcow2-cluster.c | 7 ++++--- | ||
40 | 1 file changed, 4 insertions(+), 3 deletions(-) | ||
41 | |||
42 | diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c | ||
43 | index XXXXXXX..XXXXXXX 100644 | ||
44 | --- a/block/qcow2-cluster.c | ||
45 | +++ b/block/qcow2-cluster.c | ||
46 | @@ -XXX,XX +XXX,XX @@ static bool coroutine_fn do_perform_cow_encrypt(BlockDriverState *bs, | ||
47 | assert(QEMU_IS_ALIGNED(offset_in_cluster, BDRV_SECTOR_SIZE)); | ||
48 | assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); | ||
49 | assert(s->crypto); | ||
50 | - if (qcow2_co_encrypt(bs, cluster_offset, | ||
51 | - src_cluster_offset + offset_in_cluster, | ||
52 | - buffer, bytes) < 0) { | ||
53 | + if (qcow2_co_encrypt(bs, | ||
54 | + start_of_cluster(s, cluster_offset + offset_in_cluster), | ||
55 | + src_cluster_offset + offset_in_cluster, | ||
56 | + buffer, bytes) < 0) { | ||
57 | return false; | ||
58 | } | ||
59 | } | ||
60 | -- | ||
61 | 2.21.0 | ||
62 | |||
63 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Maxim Levitsky <mlevitsk@redhat.com> | ||
2 | 1 | ||
3 | * Change the qcow2_co_{encrypt|decrypt} to just receive full host and | ||
4 | guest offsets and use this function directly instead of calling | ||
5 | do_perform_cow_encrypt (which is removed by that patch). | ||
6 | |||
7 | * Adjust qcow2_co_encdec to take full host and guest offsets as well. | ||
8 | |||
9 | * Document the qcow2_co_{encrypt|decrypt} arguments | ||
10 | to prevent the bug fixed in former commit from hopefully | ||
11 | happening again. | ||
12 | |||
13 | Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> | ||
14 | Message-id: 20190915203655.21638-3-mlevitsk@redhat.com | ||
15 | Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
16 | [mreitz: Let perform_cow() return the error value returned by | ||
17 | qcow2_co_encrypt(), as proposed by Vladimir] | ||
18 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
19 | --- | ||
20 | block/qcow2.h | 8 +++--- | ||
21 | block/qcow2-cluster.c | 41 +++++++++------------------- | ||
22 | block/qcow2-threads.c | 63 +++++++++++++++++++++++++++++++++---------- | ||
23 | block/qcow2.c | 5 ++-- | ||
24 | 4 files changed, 69 insertions(+), 48 deletions(-) | ||
25 | |||
26 | diff --git a/block/qcow2.h b/block/qcow2.h | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/block/qcow2.h | ||
29 | +++ b/block/qcow2.h | ||
30 | @@ -XXX,XX +XXX,XX @@ ssize_t coroutine_fn | ||
31 | qcow2_co_decompress(BlockDriverState *bs, void *dest, size_t dest_size, | ||
32 | const void *src, size_t src_size); | ||
33 | int coroutine_fn | ||
34 | -qcow2_co_encrypt(BlockDriverState *bs, uint64_t file_cluster_offset, | ||
35 | - uint64_t offset, void *buf, size_t len); | ||
36 | +qcow2_co_encrypt(BlockDriverState *bs, uint64_t host_offset, | ||
37 | + uint64_t guest_offset, void *buf, size_t len); | ||
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; | ||
94 | + } | ||
95 | + | ||
96 | + ret = qcow2_co_encrypt(bs, | ||
97 | + m->alloc_offset + end->offset, | ||
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; | ||
216 | -- | ||
217 | 2.21.0 | ||
218 | |||
219 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Maxim Levitsky <mlevitsk@redhat.com> | ||
2 | 1 | ||
3 | Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> | ||
4 | Tested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
5 | Message-id: 20190915203655.21638-4-mlevitsk@redhat.com | ||
6 | Reviewed-by: Max Reitz <mreitz@redhat.com> | ||
7 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
8 | --- | ||
9 | tests/qemu-iotests/263 | 91 ++++++++++++++++++++++++++++++++++++++ | ||
10 | tests/qemu-iotests/263.out | 40 +++++++++++++++++ | ||
11 | tests/qemu-iotests/group | 1 + | ||
12 | 3 files changed, 132 insertions(+) | ||
13 | create mode 100755 tests/qemu-iotests/263 | ||
14 | create mode 100644 tests/qemu-iotests/263.out | ||
15 | |||
16 | diff --git a/tests/qemu-iotests/263 b/tests/qemu-iotests/263 | ||
17 | new file mode 100755 | ||
18 | index XXXXXXX..XXXXXXX | ||
19 | --- /dev/null | ||
20 | +++ b/tests/qemu-iotests/263 | ||
21 | @@ -XXX,XX +XXX,XX @@ | ||
22 | +#!/usr/bin/env bash | ||
23 | +# | ||
24 | +# Test encrypted write that crosses cluster boundary of two unallocated clusters | ||
25 | +# Based on 188 | ||
26 | +# | ||
27 | +# Copyright (C) 2019 Red Hat, Inc. | ||
28 | +# | ||
29 | +# This program is free software; you can redistribute it and/or modify | ||
30 | +# it under the terms of the GNU General Public License as published by | ||
31 | +# the Free Software Foundation; either version 2 of the License, or | ||
32 | +# (at your option) any later version. | ||
33 | +# | ||
34 | +# This program is distributed in the hope that it will be useful, | ||
35 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
36 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
37 | +# GNU General Public License for more details. | ||
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() | ||
52 | +{ | ||
53 | + _cleanup_test_img | ||
54 | +} | ||
55 | +trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
56 | + | ||
57 | +# get standard environment, filters and checks | ||
58 | +. ./common.rc | ||
59 | +. ./common.filter | ||
60 | + | ||
61 | +_supported_fmt qcow2 | ||
62 | +_supported_proto generic | ||
63 | +_supported_os Linux | ||
64 | + | ||
65 | + | ||
66 | +size=1M | ||
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 | + | ||
87 | +} | ||
88 | + | ||
89 | + | ||
90 | +echo | ||
91 | +echo "testing LUKS qcow2 encryption" | ||
92 | +echo | ||
93 | + | ||
94 | +_make_test_img --object $SECRET -o "encrypt.format=luks,encrypt.key-secret=sec0,encrypt.iter-time=10,cluster_size=64K" $size | ||
95 | +_run_test "driver=$IMGFMT,encrypt.key-secret=sec0,file.filename=$TEST_IMG" | ||
96 | +_cleanup_test_img | ||
97 | + | ||
98 | +echo | ||
99 | +echo "testing legacy AES qcow2 encryption" | ||
100 | +echo | ||
101 | + | ||
102 | + | ||
103 | +_make_test_img --object $SECRET -o "encrypt.format=aes,encrypt.key-secret=sec0,cluster_size=64K" $size | ||
104 | +_run_test "driver=$IMGFMT,encrypt.key-secret=sec0,file.filename=$TEST_IMG" | ||
105 | +_cleanup_test_img | ||
106 | + | ||
107 | + | ||
108 | + | ||
109 | +# success, all done | ||
110 | +echo "*** done" | ||
111 | +rm -f $seq.full | ||
112 | +status=0 | ||
113 | diff --git a/tests/qemu-iotests/263.out b/tests/qemu-iotests/263.out | ||
114 | new file mode 100644 | ||
115 | index XXXXXXX..XXXXXXX | ||
116 | --- /dev/null | ||
117 | +++ b/tests/qemu-iotests/263.out | ||
118 | @@ -XXX,XX +XXX,XX @@ | ||
119 | +QA output created by 263 | ||
120 | + | ||
121 | +testing LUKS qcow2 encryption | ||
122 | + | ||
123 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 encrypt.format=luks encrypt.key-secret=sec0 encrypt.iter-time=10 | ||
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) | ||
127 | + | ||
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) | ||
131 | + | ||
132 | +== verify that the rest of the image is not changed == | ||
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) | ||
158 | +*** done | ||
159 | diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group | ||
160 | index XXXXXXX..XXXXXXX 100644 | ||
161 | --- a/tests/qemu-iotests/group | ||
162 | +++ b/tests/qemu-iotests/group | ||
163 | @@ -XXX,XX +XXX,XX @@ | ||
164 | 257 rw | ||
165 | 258 rw quick | ||
166 | 262 rw quick migration | ||
167 | +263 rw quick | ||
168 | 265 rw auto quick | ||
169 | 266 rw quick | ||
170 | -- | ||
171 | 2.21.0 | ||
172 | |||
173 | diff view generated by jsdifflib |