1 | The following changes since commit bfec359afba088aaacc7d316f43302f28c6e642a: | 1 | The following changes since commit dd25f97c66a75d1508f1d4c6478ed2c95bec428f: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/armbru/tags/pull-qdev-2017-04-21' into staging (2017-04-21 11:42:03 +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 | git://github.com/codyprime/qemu-kvm-jtc.git tags/block-pull-request | 7 | https://github.com/XanClic/qemu.git tags/pull-block-2019-09-16 |
8 | 8 | ||
9 | for you to fetch changes up to 1507631e438930bc07f776f303af127a9cdb4d41: | 9 | for you to fetch changes up to 1825cc0783ccf0ec5d9f0b225a99b340bdd4c68f: |
10 | 10 | ||
11 | qemu-iotests: _cleanup_qemu must be called on exit (2017-04-21 08:32:44 -0400) | 11 | qemu-iotests: Add test for bz #1745922 (2019-09-16 15:37:12 +0200) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | 14 | Block patches: | |
15 | Block patches for 2.10 | 15 | - Fix for block jobs when used with I/O threads |
16 | - Fix for a corruption when using qcow2's LUKS encryption mode | ||
17 | - cURL fix | ||
18 | - check-block.sh cleanups (for make check) | ||
19 | - Refactoring | ||
16 | 20 | ||
17 | ---------------------------------------------------------------- | 21 | ---------------------------------------------------------------- |
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 | ||
18 | 30 | ||
19 | Ashish Mittal (2): | 31 | Maxim Levitsky (3): |
20 | block/vxhs.c: Add support for a new block device type called "vxhs" | 32 | block/qcow2: Fix corruption introduced by commit 8ac0f15f335 |
21 | block/vxhs.c: Add qemu-iotests for new block device type "vxhs" | 33 | block/qcow2: refactor encryption code |
34 | qemu-iotests: Add test for bz #1745922 | ||
22 | 35 | ||
23 | Jeff Cody (10): | 36 | Nir Soffer (2): |
24 | qemu-iotests: exclude vxhs from image creation via protocol | 37 | block: Use QEMU_IS_ALIGNED |
25 | block: add bdrv_set_read_only() helper function | 38 | block: Remove unused masks |
26 | block: do not set BDS read_only if copy_on_read enabled | ||
27 | block: honor BDRV_O_ALLOW_RDWR when clearing bs->read_only | ||
28 | block: code movement | ||
29 | block: introduce bdrv_can_set_read_only() | ||
30 | block: use bdrv_can_set_read_only() during reopen | ||
31 | block/rbd - update variable names to more apt names | ||
32 | block/rbd: Add support for reopen() | ||
33 | qemu-iotests: _cleanup_qemu must be called on exit | ||
34 | 39 | ||
35 | block.c | 56 +++- | 40 | Sergio Lopez (1): |
36 | block/Makefile.objs | 2 + | 41 | blockjob: update nodes head while removing all bdrv |
37 | block/bochs.c | 5 +- | 42 | |
38 | block/cloop.c | 5 +- | 43 | Thomas Huth (2): |
39 | block/dmg.c | 6 +- | 44 | tests/qemu-iotests/check: Replace "tests" with "iotests" in final |
40 | block/rbd.c | 65 +++-- | 45 | status text |
41 | block/trace-events | 17 ++ | 46 | tests/Makefile: Do not print the name of the check-block.sh shell |
42 | block/vvfat.c | 19 +- | 47 | script |
43 | block/vxhs.c | 575 +++++++++++++++++++++++++++++++++++++++ | 48 | |
44 | configure | 39 +++ | 49 | Vladimir Sementsov-Ogievskiy (1): |
45 | include/block/block.h | 2 + | 50 | tests/qemu-iotests: Fix qemu-io related output in 026.out.nocache |
46 | qapi/block-core.json | 23 +- | 51 | |
47 | tests/qemu-iotests/017 | 1 + | 52 | tests/Makefile.include | 2 +- |
48 | tests/qemu-iotests/020 | 1 + | 53 | block/qcow2.h | 8 +- |
49 | tests/qemu-iotests/028 | 1 + | 54 | include/block/block.h | 2 - |
50 | tests/qemu-iotests/029 | 1 + | 55 | block/bochs.c | 4 +- |
51 | tests/qemu-iotests/073 | 1 + | 56 | block/cloop.c | 4 +- |
52 | tests/qemu-iotests/094 | 11 +- | 57 | block/curl.c | 133 ++++++++++------------- |
53 | tests/qemu-iotests/102 | 5 +- | 58 | block/dmg.c | 4 +- |
54 | tests/qemu-iotests/109 | 1 + | 59 | block/io.c | 8 +- |
55 | tests/qemu-iotests/114 | 1 + | 60 | block/qcow2-cluster.c | 40 +++---- |
56 | tests/qemu-iotests/117 | 1 + | 61 | block/qcow2-threads.c | 63 ++++++++--- |
57 | tests/qemu-iotests/130 | 2 + | 62 | block/qcow2.c | 9 +- |
58 | tests/qemu-iotests/134 | 1 + | 63 | block/vvfat.c | 8 +- |
59 | tests/qemu-iotests/140 | 1 + | 64 | blockjob.c | 17 ++- |
60 | tests/qemu-iotests/141 | 1 + | 65 | migration/block.c | 2 +- |
61 | tests/qemu-iotests/143 | 1 + | 66 | qemu-img.c | 2 +- |
62 | tests/qemu-iotests/156 | 2 + | 67 | tests/qemu-iotests/026.out.nocache | 168 ++++++++++++++--------------- |
63 | tests/qemu-iotests/158 | 1 + | 68 | tests/qemu-iotests/263 | 91 ++++++++++++++++ |
64 | tests/qemu-iotests/common | 6 + | 69 | tests/qemu-iotests/263.out | 40 +++++++ |
65 | tests/qemu-iotests/common.config | 13 + | 70 | tests/qemu-iotests/check | 8 +- |
66 | tests/qemu-iotests/common.filter | 1 + | 71 | tests/qemu-iotests/group | 1 + |
67 | tests/qemu-iotests/common.rc | 19 ++ | 72 | 20 files changed, 380 insertions(+), 234 deletions(-) |
68 | 33 files changed, 844 insertions(+), 42 deletions(-) | 73 | create mode 100755 tests/qemu-iotests/263 |
69 | create mode 100644 block/vxhs.c | 74 | create mode 100644 tests/qemu-iotests/263.out |
70 | 75 | ||
71 | -- | 76 | -- |
72 | 2.9.3 | 77 | 2.21.0 |
73 | 78 | ||
74 | 79 | diff view generated by jsdifflib |
1 | A few block drivers will set the BDS read_only flag from their | 1 | From: Nir Soffer <nirsof@gmail.com> |
---|---|---|---|
2 | .bdrv_open() function. This means the bs->read_only flag could | ||
3 | be set after we enable copy_on_read, as the BDRV_O_COPY_ON_READ | ||
4 | flag check occurs prior to the call to bdrv->bdrv_open(). | ||
5 | 2 | ||
6 | This adds an error return to bdrv_set_read_only(), and an error will be | 3 | Replace instances of: |
7 | return if we try to set the BDS to read_only while copy_on_read is | ||
8 | enabled. | ||
9 | 4 | ||
10 | This patch also changes the behavior of vvfat. Before, vvfat could | 5 | (n & (BDRV_SECTOR_SIZE - 1)) == 0 |
11 | override the drive 'readonly' flag with its own, internal 'rw' flag. | ||
12 | 6 | ||
13 | For instance, this -drive parameter would result in a writable image: | 7 | And: |
14 | 8 | ||
15 | "-drive format=vvfat,dir=/tmp/vvfat,rw,if=virtio,readonly=on" | 9 | (n & ~BDRV_SECTOR_MASK) == 0 |
16 | 10 | ||
17 | This is not correct. Now, attempting to use the above -drive parameter | 11 | With: |
18 | will result in an error (i.e., 'rw' is incompatible with 'readonly=on'). | ||
19 | 12 | ||
20 | Signed-off-by: Jeff Cody <jcody@redhat.com> | 13 | QEMU_IS_ALIGNED(n, BDRV_SECTOR_SIZE) |
21 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | 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 | ||
22 | Reviewed-by: John Snow <jsnow@redhat.com> | 20 | Reviewed-by: John Snow <jsnow@redhat.com> |
23 | Message-id: 0c5b4c1cc2c651471b131f21376dfd5ea24d2196.1491597120.git.jcody@redhat.com | 21 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
24 | --- | 22 | --- |
25 | block.c | 10 +++++++++- | 23 | block/bochs.c | 4 ++-- |
26 | block/bochs.c | 5 ++++- | 24 | block/cloop.c | 4 ++-- |
27 | block/cloop.c | 5 ++++- | 25 | block/dmg.c | 4 ++-- |
28 | block/dmg.c | 6 +++++- | 26 | block/io.c | 8 ++++---- |
29 | block/rbd.c | 11 ++++++++++- | 27 | block/qcow2-cluster.c | 4 ++-- |
30 | block/vvfat.c | 19 +++++++++++++++---- | 28 | block/qcow2.c | 4 ++-- |
31 | include/block/block.h | 2 +- | 29 | block/vvfat.c | 8 ++++---- |
32 | 7 files changed, 48 insertions(+), 10 deletions(-) | 30 | qemu-img.c | 2 +- |
31 | 8 files changed, 19 insertions(+), 19 deletions(-) | ||
33 | 32 | ||
34 | diff --git a/block.c b/block.c | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/block.c | ||
37 | +++ b/block.c | ||
38 | @@ -XXX,XX +XXX,XX @@ void path_combine(char *dest, int dest_size, | ||
39 | } | ||
40 | } | ||
41 | |||
42 | -void bdrv_set_read_only(BlockDriverState *bs, bool read_only) | ||
43 | +int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp) | ||
44 | { | ||
45 | + /* Do not set read_only if copy_on_read is enabled */ | ||
46 | + if (bs->copy_on_read && read_only) { | ||
47 | + error_setg(errp, "Can't set node '%s' to r/o with copy-on-read enabled", | ||
48 | + bdrv_get_device_or_node_name(bs)); | ||
49 | + return -EINVAL; | ||
50 | + } | ||
51 | + | ||
52 | bs->read_only = read_only; | ||
53 | + return 0; | ||
54 | } | ||
55 | |||
56 | void bdrv_get_full_backing_filename_from_filename(const char *backed, | ||
57 | diff --git a/block/bochs.c b/block/bochs.c | 33 | diff --git a/block/bochs.c b/block/bochs.c |
58 | index XXXXXXX..XXXXXXX 100644 | 34 | index XXXXXXX..XXXXXXX 100644 |
59 | --- a/block/bochs.c | 35 | --- a/block/bochs.c |
60 | +++ b/block/bochs.c | 36 | +++ b/block/bochs.c |
61 | @@ -XXX,XX +XXX,XX @@ static int bochs_open(BlockDriverState *bs, QDict *options, int flags, | 37 | @@ -XXX,XX +XXX,XX @@ bochs_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, |
62 | return -EINVAL; | 38 | QEMUIOVector local_qiov; |
63 | } | 39 | int ret; |
64 | 40 | ||
65 | - bdrv_set_read_only(bs, true); /* no write support yet */ | 41 | - assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); |
66 | + ret = bdrv_set_read_only(bs, true, errp); /* no write support yet */ | 42 | - assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); |
67 | + if (ret < 0) { | 43 | + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); |
68 | + return ret; | 44 | + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); |
69 | + } | 45 | |
70 | 46 | qemu_iovec_init(&local_qiov, qiov->niov); | |
71 | ret = bdrv_pread(bs->file, 0, &bochs, sizeof(bochs)); | 47 | qemu_co_mutex_lock(&s->lock); |
72 | if (ret < 0) { | ||
73 | diff --git a/block/cloop.c b/block/cloop.c | 48 | diff --git a/block/cloop.c b/block/cloop.c |
74 | index XXXXXXX..XXXXXXX 100644 | 49 | index XXXXXXX..XXXXXXX 100644 |
75 | --- a/block/cloop.c | 50 | --- a/block/cloop.c |
76 | +++ b/block/cloop.c | 51 | +++ b/block/cloop.c |
77 | @@ -XXX,XX +XXX,XX @@ static int cloop_open(BlockDriverState *bs, QDict *options, int flags, | 52 | @@ -XXX,XX +XXX,XX @@ cloop_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, |
78 | return -EINVAL; | 53 | int nb_sectors = bytes >> BDRV_SECTOR_BITS; |
79 | } | 54 | int ret, i; |
80 | 55 | ||
81 | - bdrv_set_read_only(bs, true); | 56 | - assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); |
82 | + ret = bdrv_set_read_only(bs, true, errp); | 57 | - assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); |
83 | + if (ret < 0) { | 58 | + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); |
84 | + return ret; | 59 | + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); |
85 | + } | 60 | |
86 | 61 | qemu_co_mutex_lock(&s->lock); | |
87 | /* read header */ | 62 | |
88 | ret = bdrv_pread(bs->file, 128, &s->block_size, 4); | ||
89 | diff --git a/block/dmg.c b/block/dmg.c | 63 | diff --git a/block/dmg.c b/block/dmg.c |
90 | index XXXXXXX..XXXXXXX 100644 | 64 | index XXXXXXX..XXXXXXX 100644 |
91 | --- a/block/dmg.c | 65 | --- a/block/dmg.c |
92 | +++ b/block/dmg.c | 66 | +++ b/block/dmg.c |
93 | @@ -XXX,XX +XXX,XX @@ static int dmg_open(BlockDriverState *bs, QDict *options, int flags, | 67 | @@ -XXX,XX +XXX,XX @@ dmg_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, |
94 | return -EINVAL; | 68 | int nb_sectors = bytes >> BDRV_SECTOR_BITS; |
95 | } | 69 | int ret, i; |
96 | 70 | ||
97 | + ret = bdrv_set_read_only(bs, true, errp); | 71 | - assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); |
98 | + if (ret < 0) { | 72 | - assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); |
99 | + return ret; | 73 | + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); |
100 | + } | 74 | + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); |
101 | + | 75 | |
102 | block_module_load_one("dmg-bz2"); | 76 | qemu_co_mutex_lock(&s->lock); |
103 | - bdrv_set_read_only(bs, true); | 77 | |
104 | 78 | diff --git a/block/io.c b/block/io.c | |
105 | s->n_chunks = 0; | ||
106 | s->offsets = s->lengths = s->sectors = s->sectorcounts = NULL; | ||
107 | diff --git a/block/rbd.c b/block/rbd.c | ||
108 | index XXXXXXX..XXXXXXX 100644 | 79 | index XXXXXXX..XXXXXXX 100644 |
109 | --- a/block/rbd.c | 80 | --- a/block/io.c |
110 | +++ b/block/rbd.c | 81 | +++ b/block/io.c |
111 | @@ -XXX,XX +XXX,XX @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags, | 82 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_driver_preadv(BlockDriverState *bs, |
112 | goto failed_shutdown; | 83 | sector_num = offset >> BDRV_SECTOR_BITS; |
113 | } | 84 | nb_sectors = bytes >> BDRV_SECTOR_BITS; |
114 | 85 | ||
115 | + /* rbd_open is always r/w */ | 86 | - assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); |
116 | r = rbd_open(s->io_ctx, s->name, &s->image, s->snap); | 87 | - assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); |
117 | if (r < 0) { | 88 | + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); |
118 | error_setg_errno(errp, -r, "error reading header from %s", s->name); | 89 | + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); |
119 | goto failed_open; | 90 | assert(bytes <= BDRV_REQUEST_MAX_BYTES); |
120 | } | 91 | assert(drv->bdrv_co_readv); |
121 | 92 | ||
122 | - bdrv_set_read_only(bs, (s->snap != NULL)); | 93 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn bdrv_driver_pwritev(BlockDriverState *bs, |
123 | + /* If we are using an rbd snapshot, we must be r/o, otherwise | 94 | sector_num = offset >> BDRV_SECTOR_BITS; |
124 | + * leave as-is */ | 95 | nb_sectors = bytes >> BDRV_SECTOR_BITS; |
125 | + if (s->snap != NULL) { | 96 | |
126 | + r = bdrv_set_read_only(bs, true, &local_err); | 97 | - assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); |
127 | + if (r < 0) { | 98 | - assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); |
128 | + error_propagate(errp, local_err); | 99 | + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); |
129 | + goto failed_open; | 100 | + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); |
130 | + } | 101 | assert(bytes <= BDRV_REQUEST_MAX_BYTES); |
131 | + } | 102 | |
132 | 103 | assert(drv->bdrv_co_writev); | |
133 | qemu_opts_del(opts); | 104 | diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c |
134 | return 0; | 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; | ||
135 | diff --git a/block/vvfat.c b/block/vvfat.c | 134 | diff --git a/block/vvfat.c b/block/vvfat.c |
136 | index XXXXXXX..XXXXXXX 100644 | 135 | index XXXXXXX..XXXXXXX 100644 |
137 | --- a/block/vvfat.c | 136 | --- a/block/vvfat.c |
138 | +++ b/block/vvfat.c | 137 | +++ b/block/vvfat.c |
139 | @@ -XXX,XX +XXX,XX @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags, | 138 | @@ -XXX,XX +XXX,XX @@ vvfat_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, |
140 | 139 | int nb_sectors = bytes >> BDRV_SECTOR_BITS; | |
141 | s->current_cluster=0xffffffff; | 140 | void *buf; |
142 | 141 | ||
143 | - /* read only is the default for safety */ | 142 | - assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); |
144 | - bdrv_set_read_only(bs, true); | 143 | - assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); |
145 | s->qcow = NULL; | 144 | + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); |
146 | s->qcow_filename = NULL; | 145 | + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); |
147 | s->fat2 = NULL; | 146 | |
148 | @@ -XXX,XX +XXX,XX @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags, | 147 | buf = g_try_malloc(bytes); |
149 | s->sector_count = cyls * heads * secs - (s->first_sectors_number - 1); | 148 | if (bytes && buf == NULL) { |
150 | 149 | @@ -XXX,XX +XXX,XX @@ vvfat_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes, | |
151 | if (qemu_opt_get_bool(opts, "rw", false)) { | 150 | int nb_sectors = bytes >> BDRV_SECTOR_BITS; |
152 | - ret = enable_write_target(bs, errp); | 151 | void *buf; |
153 | + if (!bdrv_is_read_only(bs)) { | 152 | |
154 | + ret = enable_write_target(bs, errp); | 153 | - assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); |
155 | + if (ret < 0) { | 154 | - assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); |
156 | + goto fail; | 155 | + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); |
157 | + } | 156 | + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); |
158 | + } else { | 157 | |
159 | + ret = -EPERM; | 158 | buf = g_try_malloc(bytes); |
160 | + error_setg(errp, | 159 | if (bytes && buf == NULL) { |
161 | + "Unable to set VVFAT to 'rw' when drive is read-only"); | 160 | diff --git a/qemu-img.c b/qemu-img.c |
162 | + goto fail; | ||
163 | + } | ||
164 | + } else { | ||
165 | + /* read only is the default for safety */ | ||
166 | + ret = bdrv_set_read_only(bs, true, &local_err); | ||
167 | if (ret < 0) { | ||
168 | + error_propagate(errp, local_err); | ||
169 | goto fail; | ||
170 | } | ||
171 | - bdrv_set_read_only(bs, false); | ||
172 | } | ||
173 | |||
174 | bs->total_sectors = cyls * heads * secs; | ||
175 | diff --git a/include/block/block.h b/include/block/block.h | ||
176 | index XXXXXXX..XXXXXXX 100644 | 161 | index XXXXXXX..XXXXXXX 100644 |
177 | --- a/include/block/block.h | 162 | --- a/qemu-img.c |
178 | +++ b/include/block/block.h | 163 | +++ b/qemu-img.c |
179 | @@ -XXX,XX +XXX,XX @@ int bdrv_is_allocated_above(BlockDriverState *top, BlockDriverState *base, | 164 | @@ -XXX,XX +XXX,XX @@ static int img_convert(int argc, char **argv) |
180 | int64_t sector_num, int nb_sectors, int *pnum); | 165 | int64_t sval; |
181 | 166 | ||
182 | bool bdrv_is_read_only(BlockDriverState *bs); | 167 | sval = cvtnum(optarg); |
183 | -void bdrv_set_read_only(BlockDriverState *bs, bool read_only); | 168 | - if (sval < 0 || sval & (BDRV_SECTOR_SIZE - 1) || |
184 | +int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp); | 169 | + if (sval < 0 || !QEMU_IS_ALIGNED(sval, BDRV_SECTOR_SIZE) || |
185 | bool bdrv_is_sg(BlockDriverState *bs); | 170 | sval / BDRV_SECTOR_SIZE > MAX_BUF_SECTORS) { |
186 | bool bdrv_is_inserted(BlockDriverState *bs); | 171 | error_report("Invalid buffer size for sparse output specified. " |
187 | int bdrv_media_changed(BlockDriverState *bs); | 172 | "Valid sizes are multiples of %llu up to %llu. Select " |
188 | -- | 173 | -- |
189 | 2.9.3 | 174 | 2.21.0 |
190 | 175 | ||
191 | 176 | diff view generated by jsdifflib |
1 | We have a helper wrapper for checking for the BDS read_only flag, | 1 | From: Nir Soffer <nirsof@gmail.com> |
---|---|---|---|
2 | add a helper wrapper to set the read_only flag as well. | ||
3 | 2 | ||
4 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | 3 | Replace confusing usage: |
5 | Signed-off-by: Jeff Cody <jcody@redhat.com> | 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> | ||
6 | Reviewed-by: John Snow <jsnow@redhat.com> | 17 | Reviewed-by: John Snow <jsnow@redhat.com> |
7 | Message-id: 9b18972d05f5fa2ac16c014f0af98d680553048d.1491597120.git.jcody@redhat.com | 18 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
8 | --- | 19 | --- |
9 | block.c | 5 +++++ | 20 | include/block/block.h | 2 -- |
10 | block/bochs.c | 2 +- | 21 | migration/block.c | 2 +- |
11 | block/cloop.c | 2 +- | 22 | 2 files changed, 1 insertion(+), 3 deletions(-) |
12 | block/dmg.c | 2 +- | ||
13 | block/rbd.c | 2 +- | ||
14 | block/vvfat.c | 4 ++-- | ||
15 | include/block/block.h | 1 + | ||
16 | 7 files changed, 12 insertions(+), 6 deletions(-) | ||
17 | 23 | ||
18 | diff --git a/block.c b/block.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/block.c | ||
21 | +++ b/block.c | ||
22 | @@ -XXX,XX +XXX,XX @@ void path_combine(char *dest, int dest_size, | ||
23 | } | ||
24 | } | ||
25 | |||
26 | +void bdrv_set_read_only(BlockDriverState *bs, bool read_only) | ||
27 | +{ | ||
28 | + bs->read_only = read_only; | ||
29 | +} | ||
30 | + | ||
31 | void bdrv_get_full_backing_filename_from_filename(const char *backed, | ||
32 | const char *backing, | ||
33 | char *dest, size_t sz, | ||
34 | diff --git a/block/bochs.c b/block/bochs.c | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/block/bochs.c | ||
37 | +++ b/block/bochs.c | ||
38 | @@ -XXX,XX +XXX,XX @@ static int bochs_open(BlockDriverState *bs, QDict *options, int flags, | ||
39 | return -EINVAL; | ||
40 | } | ||
41 | |||
42 | - bs->read_only = true; /* no write support yet */ | ||
43 | + bdrv_set_read_only(bs, true); /* no write support yet */ | ||
44 | |||
45 | ret = bdrv_pread(bs->file, 0, &bochs, sizeof(bochs)); | ||
46 | if (ret < 0) { | ||
47 | diff --git a/block/cloop.c b/block/cloop.c | ||
48 | index XXXXXXX..XXXXXXX 100644 | ||
49 | --- a/block/cloop.c | ||
50 | +++ b/block/cloop.c | ||
51 | @@ -XXX,XX +XXX,XX @@ static int cloop_open(BlockDriverState *bs, QDict *options, int flags, | ||
52 | return -EINVAL; | ||
53 | } | ||
54 | |||
55 | - bs->read_only = true; | ||
56 | + bdrv_set_read_only(bs, true); | ||
57 | |||
58 | /* read header */ | ||
59 | ret = bdrv_pread(bs->file, 128, &s->block_size, 4); | ||
60 | diff --git a/block/dmg.c b/block/dmg.c | ||
61 | index XXXXXXX..XXXXXXX 100644 | ||
62 | --- a/block/dmg.c | ||
63 | +++ b/block/dmg.c | ||
64 | @@ -XXX,XX +XXX,XX @@ static int dmg_open(BlockDriverState *bs, QDict *options, int flags, | ||
65 | } | ||
66 | |||
67 | block_module_load_one("dmg-bz2"); | ||
68 | - bs->read_only = true; | ||
69 | + bdrv_set_read_only(bs, true); | ||
70 | |||
71 | s->n_chunks = 0; | ||
72 | s->offsets = s->lengths = s->sectors = s->sectorcounts = NULL; | ||
73 | diff --git a/block/rbd.c b/block/rbd.c | ||
74 | index XXXXXXX..XXXXXXX 100644 | ||
75 | --- a/block/rbd.c | ||
76 | +++ b/block/rbd.c | ||
77 | @@ -XXX,XX +XXX,XX @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags, | ||
78 | goto failed_open; | ||
79 | } | ||
80 | |||
81 | - bs->read_only = (s->snap != NULL); | ||
82 | + bdrv_set_read_only(bs, (s->snap != NULL)); | ||
83 | |||
84 | qemu_opts_del(opts); | ||
85 | return 0; | ||
86 | diff --git a/block/vvfat.c b/block/vvfat.c | ||
87 | index XXXXXXX..XXXXXXX 100644 | ||
88 | --- a/block/vvfat.c | ||
89 | +++ b/block/vvfat.c | ||
90 | @@ -XXX,XX +XXX,XX @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags, | ||
91 | s->current_cluster=0xffffffff; | ||
92 | |||
93 | /* read only is the default for safety */ | ||
94 | - bs->read_only = true; | ||
95 | + bdrv_set_read_only(bs, true); | ||
96 | s->qcow = NULL; | ||
97 | s->qcow_filename = NULL; | ||
98 | s->fat2 = NULL; | ||
99 | @@ -XXX,XX +XXX,XX @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags, | ||
100 | if (ret < 0) { | ||
101 | goto fail; | ||
102 | } | ||
103 | - bs->read_only = false; | ||
104 | + bdrv_set_read_only(bs, false); | ||
105 | } | ||
106 | |||
107 | bs->total_sectors = cyls * heads * secs; | ||
108 | diff --git a/include/block/block.h b/include/block/block.h | 24 | diff --git a/include/block/block.h b/include/block/block.h |
109 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
110 | --- a/include/block/block.h | 26 | --- a/include/block/block.h |
111 | +++ b/include/block/block.h | 27 | +++ b/include/block/block.h |
112 | @@ -XXX,XX +XXX,XX @@ int bdrv_is_allocated_above(BlockDriverState *top, BlockDriverState *base, | 28 | @@ -XXX,XX +XXX,XX @@ typedef struct HDGeometry { |
113 | int64_t sector_num, int nb_sectors, int *pnum); | 29 | |
114 | 30 | #define BDRV_SECTOR_BITS 9 | |
115 | bool bdrv_is_read_only(BlockDriverState *bs); | 31 | #define BDRV_SECTOR_SIZE (1ULL << BDRV_SECTOR_BITS) |
116 | +void bdrv_set_read_only(BlockDriverState *bs, bool read_only); | 32 | -#define BDRV_SECTOR_MASK ~(BDRV_SECTOR_SIZE - 1) |
117 | bool bdrv_is_sg(BlockDriverState *bs); | 33 | |
118 | bool bdrv_is_inserted(BlockDriverState *bs); | 34 | #define BDRV_REQUEST_MAX_SECTORS MIN(SIZE_MAX >> BDRV_SECTOR_BITS, \ |
119 | int bdrv_media_changed(BlockDriverState *bs); | 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) { | ||
120 | -- | 57 | -- |
121 | 2.9.3 | 58 | 2.21.0 |
122 | 59 | ||
123 | 60 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Thomas Huth <thuth@redhat.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Thomas Huth <thuth@redhat.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
1 | 2 | ||
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 |
1 | This adds support for reopen in rbd, for changing between r/w and r/o. | 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. | ||
2 | 4 | ||
3 | Note, that this is only a flag change, but we will block a change from | 5 | Cc: qemu-stable@nongnu.org |
4 | r/o to r/w if we are using an RBD internal snapshot. | 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(+) | ||
5 | 14 | ||
6 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | 15 | diff --git a/block/curl.c b/block/curl.c |
7 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
8 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
9 | Message-id: d4e87539167ec6527d44c97b164eabcccf96e4f3.1491597120.git.jcody@redhat.com | ||
10 | --- | ||
11 | block/rbd.c | 21 +++++++++++++++++++++ | ||
12 | 1 file changed, 21 insertions(+) | ||
13 | |||
14 | diff --git a/block/rbd.c b/block/rbd.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/block/rbd.c | 17 | --- a/block/curl.c |
17 | +++ b/block/rbd.c | 18 | +++ b/block/curl.c |
18 | @@ -XXX,XX +XXX,XX @@ failed_opts: | 19 | @@ -XXX,XX +XXX,XX @@ static CURLMcode __curl_multi_socket_action(CURLM *multi_handle, |
19 | return r; | 20 | #define CURL_BLOCK_OPT_TIMEOUT_DEFAULT 5 |
20 | } | 21 | |
21 | 22 | struct BDRVCURLState; | |
22 | + | 23 | +struct CURLState; |
23 | +/* Since RBD is currently always opened R/W via the API, | 24 | |
24 | + * we just need to check if we are using a snapshot or not, in | 25 | static bool libcurl_initialized; |
25 | + * order to determine if we will allow it to be R/W */ | 26 | |
26 | +static int qemu_rbd_reopen_prepare(BDRVReopenState *state, | 27 | @@ -XXX,XX +XXX,XX @@ typedef struct CURLAIOCB { |
27 | + BlockReopenQueue *queue, Error **errp) | 28 | |
28 | +{ | 29 | typedef struct CURLSocket { |
29 | + BDRVRBDState *s = state->bs->opaque; | 30 | int fd; |
30 | + int ret = 0; | 31 | + struct CURLState *state; |
31 | + | 32 | QLIST_ENTRY(CURLSocket) next; |
32 | + if (s->snap && state->flags & BDRV_O_RDWR) { | 33 | } CURLSocket; |
33 | + error_setg(errp, | 34 | |
34 | + "Cannot change node '%s' to r/w when using RBD snapshot", | 35 | @@ -XXX,XX +XXX,XX @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action, |
35 | + bdrv_get_device_or_node_name(state->bs)); | 36 | if (!socket) { |
36 | + ret = -EINVAL; | 37 | socket = g_new0(CURLSocket, 1); |
37 | + } | 38 | socket->fd = fd; |
38 | + | 39 | + socket->state = state; |
39 | + return ret; | 40 | QLIST_INSERT_HEAD(&state->sockets, socket, next); |
40 | +} | 41 | } |
41 | + | 42 | socket = NULL; |
42 | static void qemu_rbd_close(BlockDriverState *bs) | ||
43 | { | ||
44 | BDRVRBDState *s = bs->opaque; | ||
45 | @@ -XXX,XX +XXX,XX @@ static BlockDriver bdrv_rbd = { | ||
46 | .bdrv_parse_filename = qemu_rbd_parse_filename, | ||
47 | .bdrv_file_open = qemu_rbd_open, | ||
48 | .bdrv_close = qemu_rbd_close, | ||
49 | + .bdrv_reopen_prepare = qemu_rbd_reopen_prepare, | ||
50 | .bdrv_create = qemu_rbd_create, | ||
51 | .bdrv_has_zero_init = bdrv_has_zero_init_1, | ||
52 | .bdrv_get_info = qemu_rbd_getinfo, | ||
53 | -- | 43 | -- |
54 | 2.9.3 | 44 | 2.21.0 |
55 | 45 | ||
56 | 46 | diff view generated by jsdifflib |
1 | Update 'clientname' to be 'user', which tracks better with both | 1 | This does not really change anything, but it makes the code a bit easier |
---|---|---|---|
2 | the QAPI and rados variable naming. | 2 | to follow once we use @socket as the opaque pointer for |
3 | aio_set_fd_handler(). | ||
3 | 4 | ||
4 | Update 'name' to be 'image_name', as it indicates the rbd image. | 5 | Cc: qemu-stable@nongnu.org |
5 | Naming it 'image' would have been ideal, but we are using that for | 6 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
6 | the rados_image_t value returned by rbd_open(). | 7 | Message-id: 20190910124136.10565-3-mreitz@redhat.com |
8 | Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> | ||
9 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
10 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
11 | --- | ||
12 | block/curl.c | 10 +++++----- | ||
13 | 1 file changed, 5 insertions(+), 5 deletions(-) | ||
7 | 14 | ||
8 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | 15 | diff --git a/block/curl.c b/block/curl.c |
9 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
10 | Reviewed-by: John Snow <jsnow@redhat.com> | ||
11 | Message-id: b7ec1fb2e1cf36f9b6911631447a5b0422590b7d.1491597120.git.jcody@redhat.com | ||
12 | --- | ||
13 | block/rbd.c | 33 +++++++++++++++++---------------- | ||
14 | 1 file changed, 17 insertions(+), 16 deletions(-) | ||
15 | |||
16 | diff --git a/block/rbd.c b/block/rbd.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/block/rbd.c | 17 | --- a/block/curl.c |
19 | +++ b/block/rbd.c | 18 | +++ b/block/curl.c |
20 | @@ -XXX,XX +XXX,XX @@ typedef struct BDRVRBDState { | 19 | @@ -XXX,XX +XXX,XX @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action, |
21 | rados_t cluster; | 20 | |
22 | rados_ioctx_t io_ctx; | 21 | QLIST_FOREACH(socket, &state->sockets, next) { |
23 | rbd_image_t image; | 22 | if (socket->fd == fd) { |
24 | - char *name; | 23 | - if (action == CURL_POLL_REMOVE) { |
25 | + char *image_name; | 24 | - QLIST_REMOVE(socket, next); |
26 | char *snap; | 25 | - g_free(socket); |
27 | } BDRVRBDState; | 26 | - } |
28 | 27 | break; | |
29 | @@ -XXX,XX +XXX,XX @@ static int qemu_rbd_create(const char *filename, QemuOpts *opts, Error **errp) | 28 | } |
30 | int64_t bytes = 0; | ||
31 | int64_t objsize; | ||
32 | int obj_order = 0; | ||
33 | - const char *pool, *name, *conf, *clientname, *keypairs; | ||
34 | + const char *pool, *image_name, *conf, *user, *keypairs; | ||
35 | const char *secretid; | ||
36 | rados_t cluster; | ||
37 | rados_ioctx_t io_ctx; | ||
38 | @@ -XXX,XX +XXX,XX @@ static int qemu_rbd_create(const char *filename, QemuOpts *opts, Error **errp) | ||
39 | */ | ||
40 | pool = qdict_get_try_str(options, "pool"); | ||
41 | conf = qdict_get_try_str(options, "conf"); | ||
42 | - clientname = qdict_get_try_str(options, "user"); | ||
43 | - name = qdict_get_try_str(options, "image"); | ||
44 | + user = qdict_get_try_str(options, "user"); | ||
45 | + image_name = qdict_get_try_str(options, "image"); | ||
46 | keypairs = qdict_get_try_str(options, "=keyvalue-pairs"); | ||
47 | |||
48 | - ret = rados_create(&cluster, clientname); | ||
49 | + ret = rados_create(&cluster, user); | ||
50 | if (ret < 0) { | ||
51 | error_setg_errno(errp, -ret, "error initializing"); | ||
52 | goto exit; | ||
53 | @@ -XXX,XX +XXX,XX @@ static int qemu_rbd_create(const char *filename, QemuOpts *opts, Error **errp) | ||
54 | goto shutdown; | ||
55 | } | 29 | } |
56 | 30 | @@ -XXX,XX +XXX,XX @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action, | |
57 | - ret = rbd_create(io_ctx, name, bytes, &obj_order); | 31 | socket->state = state; |
58 | + ret = rbd_create(io_ctx, image_name, bytes, &obj_order); | 32 | QLIST_INSERT_HEAD(&state->sockets, socket, next); |
59 | if (ret < 0) { | ||
60 | error_setg_errno(errp, -ret, "error rbd create"); | ||
61 | } | 33 | } |
62 | @@ -XXX,XX +XXX,XX @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags, | 34 | - socket = NULL; |
63 | Error **errp) | 35 | |
64 | { | 36 | trace_curl_sock_cb(action, (int)fd); |
65 | BDRVRBDState *s = bs->opaque; | 37 | switch (action) { |
66 | - const char *pool, *snap, *conf, *clientname, *name, *keypairs; | 38 | @@ -XXX,XX +XXX,XX @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action, |
67 | + const char *pool, *snap, *conf, *user, *image_name, *keypairs; | 39 | break; |
68 | const char *secretid; | ||
69 | QemuOpts *opts; | ||
70 | Error *local_err = NULL; | ||
71 | @@ -XXX,XX +XXX,XX @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags, | ||
72 | pool = qemu_opt_get(opts, "pool"); | ||
73 | conf = qemu_opt_get(opts, "conf"); | ||
74 | snap = qemu_opt_get(opts, "snapshot"); | ||
75 | - clientname = qemu_opt_get(opts, "user"); | ||
76 | - name = qemu_opt_get(opts, "image"); | ||
77 | + user = qemu_opt_get(opts, "user"); | ||
78 | + image_name = qemu_opt_get(opts, "image"); | ||
79 | keypairs = qemu_opt_get(opts, "=keyvalue-pairs"); | ||
80 | |||
81 | - if (!pool || !name) { | ||
82 | + if (!pool || !image_name) { | ||
83 | error_setg(errp, "Parameters 'pool' and 'image' are required"); | ||
84 | r = -EINVAL; | ||
85 | goto failed_opts; | ||
86 | } | 40 | } |
87 | 41 | ||
88 | - r = rados_create(&s->cluster, clientname); | 42 | + if (action == CURL_POLL_REMOVE) { |
89 | + r = rados_create(&s->cluster, user); | 43 | + QLIST_REMOVE(socket, next); |
90 | if (r < 0) { | 44 | + g_free(socket); |
91 | error_setg_errno(errp, -r, "error initializing"); | 45 | + } |
92 | goto failed_opts; | 46 | + |
93 | } | 47 | return 0; |
94 | |||
95 | s->snap = g_strdup(snap); | ||
96 | - s->name = g_strdup(name); | ||
97 | + s->image_name = g_strdup(image_name); | ||
98 | |||
99 | /* try default location when conf=NULL, but ignore failure */ | ||
100 | r = rados_conf_read_file(s->cluster, conf); | ||
101 | @@ -XXX,XX +XXX,XX @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags, | ||
102 | } | ||
103 | |||
104 | /* rbd_open is always r/w */ | ||
105 | - r = rbd_open(s->io_ctx, s->name, &s->image, s->snap); | ||
106 | + r = rbd_open(s->io_ctx, s->image_name, &s->image, s->snap); | ||
107 | if (r < 0) { | ||
108 | - error_setg_errno(errp, -r, "error reading header from %s", s->name); | ||
109 | + error_setg_errno(errp, -r, "error reading header from %s", | ||
110 | + s->image_name); | ||
111 | goto failed_open; | ||
112 | } | ||
113 | |||
114 | @@ -XXX,XX +XXX,XX @@ failed_open: | ||
115 | failed_shutdown: | ||
116 | rados_shutdown(s->cluster); | ||
117 | g_free(s->snap); | ||
118 | - g_free(s->name); | ||
119 | + g_free(s->image_name); | ||
120 | failed_opts: | ||
121 | qemu_opts_del(opts); | ||
122 | g_free(mon_host); | ||
123 | @@ -XXX,XX +XXX,XX @@ static void qemu_rbd_close(BlockDriverState *bs) | ||
124 | rbd_close(s->image); | ||
125 | rados_ioctx_destroy(s->io_ctx); | ||
126 | g_free(s->snap); | ||
127 | - g_free(s->name); | ||
128 | + g_free(s->image_name); | ||
129 | rados_shutdown(s->cluster); | ||
130 | } | 48 | } |
131 | 49 | ||
132 | -- | 50 | -- |
133 | 2.9.3 | 51 | 2.21.0 |
134 | 52 | ||
135 | 53 | diff view generated by jsdifflib |
1 | Signed-off-by: Jeff Cody <jcody@redhat.com> | 1 | While it is more likely that transfers complete after some file |
---|---|---|---|
2 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | 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. | ||
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> | ||
3 | Reviewed-by: John Snow <jsnow@redhat.com> | 13 | Reviewed-by: John Snow <jsnow@redhat.com> |
4 | Message-id: 00aed7ffdd7be4b9ed9ce1007d50028a72b34ebe.1491597120.git.jcody@redhat.com | 14 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
5 | --- | 15 | --- |
6 | block.c | 14 ++++++++------ | 16 | block/curl.c | 14 ++------------ |
7 | 1 file changed, 8 insertions(+), 6 deletions(-) | 17 | 1 file changed, 2 insertions(+), 12 deletions(-) |
8 | 18 | ||
9 | diff --git a/block.c b/block.c | 19 | diff --git a/block/curl.c b/block/curl.c |
10 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
11 | --- a/block.c | 21 | --- a/block/curl.c |
12 | +++ b/block.c | 22 | +++ b/block/curl.c |
13 | @@ -XXX,XX +XXX,XX @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue, | 23 | @@ -XXX,XX +XXX,XX @@ typedef struct BDRVCURLState { |
14 | BlockDriver *drv; | 24 | |
15 | QemuOpts *opts; | 25 | static void curl_clean_state(CURLState *s); |
16 | const char *value; | 26 | static void curl_multi_do(void *arg); |
17 | + bool read_only; | 27 | -static void curl_multi_read(void *arg); |
18 | 28 | ||
19 | assert(reopen_state != NULL); | 29 | #ifdef NEED_CURL_TIMER_CALLBACK |
20 | assert(reopen_state->bs->drv != NULL); | 30 | /* Called from curl_multi_do_locked, with s->mutex held. */ |
21 | @@ -XXX,XX +XXX,XX @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue, | 31 | @@ -XXX,XX +XXX,XX @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action, |
22 | qdict_put(reopen_state->options, "driver", qstring_from_str(value)); | 32 | switch (action) { |
23 | } | 33 | case CURL_POLL_IN: |
24 | 34 | aio_set_fd_handler(s->aio_context, fd, false, | |
25 | - /* if we are to stay read-only, do not allow permission change | 35 | - curl_multi_read, NULL, NULL, state); |
26 | - * to r/w */ | 36 | + curl_multi_do, NULL, NULL, state); |
27 | - if (!(reopen_state->bs->open_flags & BDRV_O_ALLOW_RDWR) && | 37 | break; |
28 | - reopen_state->flags & BDRV_O_RDWR) { | 38 | case CURL_POLL_OUT: |
29 | - error_setg(errp, "Node '%s' is read only", | 39 | aio_set_fd_handler(s->aio_context, fd, false, |
30 | - bdrv_get_device_or_node_name(reopen_state->bs)); | 40 | @@ -XXX,XX +XXX,XX @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action, |
31 | + /* If we are to stay read-only, do not allow permission change | 41 | break; |
32 | + * to r/w. Attempting to set to r/w may fail if either BDRV_O_ALLOW_RDWR is | 42 | case CURL_POLL_INOUT: |
33 | + * not set, or if the BDS still has copy_on_read enabled */ | 43 | aio_set_fd_handler(s->aio_context, fd, false, |
34 | + read_only = !(reopen_state->flags & BDRV_O_RDWR); | 44 | - curl_multi_read, curl_multi_do, NULL, state); |
35 | + ret = bdrv_can_set_read_only(reopen_state->bs, read_only, &local_err); | 45 | + curl_multi_do, curl_multi_do, NULL, state); |
36 | + if (local_err) { | 46 | break; |
37 | + error_propagate(errp, local_err); | 47 | case CURL_POLL_REMOVE: |
38 | goto error; | 48 | aio_set_fd_handler(s->aio_context, fd, false, |
39 | } | 49 | @@ -XXX,XX +XXX,XX @@ static void curl_multi_do(void *arg) |
40 | 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); | ||
41 | -- | 65 | -- |
42 | 2.9.3 | 66 | 2.21.0 |
43 | 67 | ||
44 | 68 | diff view generated by jsdifflib |
1 | Move bdrv_is_read_only() up with its friends. | 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. | ||
2 | 6 | ||
3 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | 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> | ||
4 | Reviewed-by: John Snow <jsnow@redhat.com> | 11 | Reviewed-by: John Snow <jsnow@redhat.com> |
5 | Signed-off-by: Jeff Cody <jcody@redhat.com> | 12 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
6 | Message-id: 73b2399459760c32506f9407efb9dddb3a2789de.1491597120.git.jcody@redhat.com | ||
7 | --- | 13 | --- |
8 | block.c | 10 +++++----- | 14 | block/curl.c | 20 +++++++++++--------- |
9 | 1 file changed, 5 insertions(+), 5 deletions(-) | 15 | 1 file changed, 11 insertions(+), 9 deletions(-) |
10 | 16 | ||
11 | diff --git a/block.c b/block.c | 17 | diff --git a/block/curl.c b/block/curl.c |
12 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/block.c | 19 | --- a/block/curl.c |
14 | +++ b/block.c | 20 | +++ b/block/curl.c |
15 | @@ -XXX,XX +XXX,XX @@ void path_combine(char *dest, int dest_size, | 21 | @@ -XXX,XX +XXX,XX @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action, |
16 | } | 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) | ||
17 | } | 41 | } |
18 | 42 | ||
19 | +bool bdrv_is_read_only(BlockDriverState *bs) | 43 | /* Called with s->mutex held. */ |
20 | +{ | 44 | -static void curl_multi_do_locked(CURLState *s) |
21 | + return bs->read_only; | 45 | +static void curl_multi_do_locked(CURLSocket *ready_socket) |
22 | +} | ||
23 | + | ||
24 | int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp) | ||
25 | { | 46 | { |
26 | /* Do not set read_only if copy_on_read is enabled */ | 47 | CURLSocket *socket, *next_socket; |
27 | @@ -XXX,XX +XXX,XX @@ void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr) | 48 | + CURLState *s = ready_socket->state; |
28 | *nb_sectors_ptr = nb_sectors < 0 ? 0 : nb_sectors; | 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); | ||
29 | } | 68 | } |
30 | 69 | ||
31 | -bool bdrv_is_read_only(BlockDriverState *bs) | 70 | static void curl_multi_timeout_do(void *arg) |
32 | -{ | ||
33 | - return bs->read_only; | ||
34 | -} | ||
35 | - | ||
36 | bool bdrv_is_sg(BlockDriverState *bs) | ||
37 | { | ||
38 | return bs->sg; | ||
39 | -- | 71 | -- |
40 | 2.9.3 | 72 | 2.21.0 |
41 | 73 | ||
42 | 74 | diff view generated by jsdifflib |
1 | Introduce check function for setting read_only flags. Will return < 0 on | 1 | Instead of reporting all sockets to cURL, only report the one that has |
---|---|---|---|
2 | error, with appropriate Error value set. Does not alter any flags. | 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. | ||
3 | 8 | ||
4 | Signed-off-by: Jeff Cody <jcody@redhat.com> | 9 | Fixes: ff5ca1664af85b24a4180d595ea6873fd3deac57 |
5 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | 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> | ||
6 | Reviewed-by: John Snow <jsnow@redhat.com> | 14 | Reviewed-by: John Snow <jsnow@redhat.com> |
7 | Message-id: e2bba34ac3bc76a0c42adc390413f358ae0566e8.1491597120.git.jcody@redhat.com | 15 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
8 | --- | 16 | --- |
9 | block.c | 14 +++++++++++++- | 17 | block/curl.c | 17 ++++++----------- |
10 | include/block/block.h | 1 + | 18 | 1 file changed, 6 insertions(+), 11 deletions(-) |
11 | 2 files changed, 14 insertions(+), 1 deletion(-) | ||
12 | 19 | ||
13 | diff --git a/block.c b/block.c | 20 | diff --git a/block/curl.c b/block/curl.c |
14 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/block.c | 22 | --- a/block/curl.c |
16 | +++ b/block.c | 23 | +++ b/block/curl.c |
17 | @@ -XXX,XX +XXX,XX @@ bool bdrv_is_read_only(BlockDriverState *bs) | 24 | @@ -XXX,XX +XXX,XX @@ static void curl_multi_check_completion(BDRVCURLState *s) |
18 | return bs->read_only; | ||
19 | } | 25 | } |
20 | 26 | ||
21 | -int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp) | 27 | /* Called with s->mutex held. */ |
22 | +int bdrv_can_set_read_only(BlockDriverState *bs, bool read_only, Error **errp) | 28 | -static void curl_multi_do_locked(CURLSocket *ready_socket) |
29 | +static void curl_multi_do_locked(CURLSocket *socket) | ||
23 | { | 30 | { |
24 | /* Do not set read_only if copy_on_read is enabled */ | 31 | - CURLSocket *socket, *next_socket; |
25 | if (bs->copy_on_read && read_only) { | 32 | - CURLState *s = ready_socket->state; |
26 | @@ -XXX,XX +XXX,XX @@ int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp) | 33 | + BDRVCURLState *s = socket->state->s; |
27 | return -EPERM; | 34 | int running; |
35 | int r; | ||
36 | |||
37 | - if (!s->s->multi) { | ||
38 | + if (!s->multi) { | ||
39 | return; | ||
28 | } | 40 | } |
29 | 41 | ||
30 | + return 0; | 42 | - /* Need to use _SAFE because curl_multi_socket_action() may trigger |
31 | +} | 43 | - * curl_sock_cb() which might modify this list */ |
32 | + | 44 | - QLIST_FOREACH_SAFE(socket, &s->sockets, next, next_socket) { |
33 | +int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp) | 45 | - do { |
34 | +{ | 46 | - r = curl_multi_socket_action(s->s->multi, socket->fd, 0, &running); |
35 | + int ret = 0; | 47 | - } while (r == CURLM_CALL_MULTI_PERFORM); |
36 | + | 48 | - } |
37 | + ret = bdrv_can_set_read_only(bs, read_only, errp); | 49 | + do { |
38 | + if (ret < 0) { | 50 | + r = curl_multi_socket_action(s->multi, socket->fd, 0, &running); |
39 | + return ret; | 51 | + } while (r == CURLM_CALL_MULTI_PERFORM); |
40 | + } | ||
41 | + | ||
42 | bs->read_only = read_only; | ||
43 | return 0; | ||
44 | } | 52 | } |
45 | diff --git a/include/block/block.h b/include/block/block.h | 53 | |
46 | index XXXXXXX..XXXXXXX 100644 | 54 | static void curl_multi_do(void *arg) |
47 | --- a/include/block/block.h | ||
48 | +++ b/include/block/block.h | ||
49 | @@ -XXX,XX +XXX,XX @@ int bdrv_is_allocated_above(BlockDriverState *top, BlockDriverState *base, | ||
50 | int64_t sector_num, int nb_sectors, int *pnum); | ||
51 | |||
52 | bool bdrv_is_read_only(BlockDriverState *bs); | ||
53 | +int bdrv_can_set_read_only(BlockDriverState *bs, bool read_only, Error **errp); | ||
54 | int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp); | ||
55 | bool bdrv_is_sg(BlockDriverState *bs); | ||
56 | bool bdrv_is_inserted(BlockDriverState *bs); | ||
57 | -- | 55 | -- |
58 | 2.9.3 | 56 | 2.21.0 |
59 | 57 | ||
60 | 58 | diff view generated by jsdifflib |
1 | The BDRV_O_ALLOW_RDWR flag allows / prohibits the changing of | 1 | Background: As of cURL 7.59.0, it verifies that several functions are |
---|---|---|---|
2 | the BDS 'read_only' state, but there are a few places where it | 2 | not called from within a callback. Among these functions is |
3 | is ignored. In the bdrv_set_read_only() helper, make sure to | 3 | curl_multi_add_handle(). |
4 | honor the flag. | ||
5 | 4 | ||
6 | Signed-off-by: Jeff Cody <jcody@redhat.com> | 5 | curl_read_cb() is a callback from cURL and not a coroutine. Waking up |
7 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | 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 | ||
8 | Reviewed-by: John Snow <jsnow@redhat.com> | 24 | Reviewed-by: John Snow <jsnow@redhat.com> |
9 | Message-id: be2e5fb2d285cbece2b6d06bed54a6f56520d251.1491597120.git.jcody@redhat.com | 25 | Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> |
26 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
10 | --- | 27 | --- |
11 | block.c | 7 +++++++ | 28 | block/curl.c | 69 ++++++++++++++++++++++------------------------------ |
12 | 1 file changed, 7 insertions(+) | 29 | 1 file changed, 29 insertions(+), 40 deletions(-) |
13 | 30 | ||
14 | diff --git a/block.c b/block.c | 31 | diff --git a/block/curl.c b/block/curl.c |
15 | index XXXXXXX..XXXXXXX 100644 | 32 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/block.c | 33 | --- a/block/curl.c |
17 | +++ b/block.c | 34 | +++ b/block/curl.c |
18 | @@ -XXX,XX +XXX,XX @@ int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp) | 35 | @@ -XXX,XX +XXX,XX @@ static size_t curl_read_cb(void *ptr, size_t size, size_t nmemb, void *opaque) |
19 | return -EINVAL; | 36 | { |
20 | } | 37 | CURLState *s = ((CURLState*)opaque); |
21 | 38 | size_t realsize = size * nmemb; | |
22 | + /* Do not clear read_only if it is prohibited */ | 39 | - int i; |
23 | + if (!read_only && !(bs->open_flags & BDRV_O_ALLOW_RDWR)) { | 40 | |
24 | + error_setg(errp, "Node '%s' is read only", | 41 | trace_curl_read_cb(realsize); |
25 | + bdrv_get_device_or_node_name(bs)); | 42 | |
26 | + return -EPERM; | 43 | @@ -XXX,XX +XXX,XX @@ static size_t curl_read_cb(void *ptr, size_t size, size_t nmemb, void *opaque) |
27 | + } | 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; | ||
28 | + | 83 | + |
29 | bs->read_only = read_only; | 84 | curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, |
30 | return 0; | 85 | (char **)&state); |
31 | } | 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); | ||
32 | -- | 140 | -- |
33 | 2.9.3 | 141 | 2.21.0 |
34 | 142 | ||
35 | 143 | diff view generated by jsdifflib |
1 | From: Ashish Mittal <ashmit602@gmail.com> | 1 | If we had done that all along, debugging would have been much simpler. |
---|---|---|---|
2 | (Also, I/O errors are better than hangs.) | ||
2 | 3 | ||
3 | Source code for the qnio library that this code loads can be downloaded from: | 4 | Signed-off-by: Max Reitz <mreitz@redhat.com> |
4 | https://github.com/VeritasHyperScale/libqnio.git | 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(-) | ||
5 | 12 | ||
6 | Sample command line using JSON syntax: | 13 | diff --git a/block/curl.c b/block/curl.c |
7 | ./x86_64-softmmu/qemu-system-x86_64 -name instance-00000008 -S -vnc 0.0.0.0:0 | ||
8 | -k en-us -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 | ||
9 | -msg timestamp=on | ||
10 | 'json:{"driver":"vxhs","vdisk-id":"c3e9095a-a5ee-4dce-afeb-2a59fb387410", | ||
11 | "server":{"host":"172.172.17.4","port":"9999"}}' | ||
12 | |||
13 | Sample command line using URI syntax: | ||
14 | qemu-img convert -f raw -O raw -n | ||
15 | /var/lib/nova/instances/_base/0c5eacd5ebea5ed914b6a3e7b18f1ce734c386ad | ||
16 | vxhs://192.168.0.1:9999/c6718f6b-0401-441d-a8c3-1f0064d75ee0 | ||
17 | |||
18 | Sample command line using TLS credentials (run in secure mode): | ||
19 | ./qemu-io --object | ||
20 | tls-creds-x509,id=tls0,dir=/etc/pki/qemu/vxhs,endpoint=client -c 'read | ||
21 | -v 66000 2.5k' 'json:{"server.host": "127.0.0.1", "server.port": "9999", | ||
22 | "vdisk-id": "/test.raw", "driver": "vxhs", "tls-creds":"tls0"}' | ||
23 | |||
24 | Signed-off-by: Ashish Mittal <Ashish.Mittal@veritas.com> | ||
25 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
26 | Reviewed-by: Jeff Cody <jcody@redhat.com> | ||
27 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
28 | Message-id: 1491277689-24949-2-git-send-email-Ashish.Mittal@veritas.com | ||
29 | --- | ||
30 | block/Makefile.objs | 2 + | ||
31 | block/trace-events | 17 ++ | ||
32 | block/vxhs.c | 575 +++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
33 | configure | 39 ++++ | ||
34 | qapi/block-core.json | 23 ++- | ||
35 | 5 files changed, 654 insertions(+), 2 deletions(-) | ||
36 | create mode 100644 block/vxhs.c | ||
37 | |||
38 | diff --git a/block/Makefile.objs b/block/Makefile.objs | ||
39 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
40 | --- a/block/Makefile.objs | 15 | --- a/block/curl.c |
41 | +++ b/block/Makefile.objs | 16 | +++ b/block/curl.c |
42 | @@ -XXX,XX +XXX,XX @@ block-obj-$(CONFIG_LIBNFS) += nfs.o | 17 | @@ -XXX,XX +XXX,XX @@ static void curl_setup_preadv(BlockDriverState *bs, CURLAIOCB *acb) |
43 | block-obj-$(CONFIG_CURL) += curl.o | 18 | trace_curl_setup_preadv(acb->bytes, start, state->range); |
44 | block-obj-$(CONFIG_RBD) += rbd.o | 19 | curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range); |
45 | block-obj-$(CONFIG_GLUSTERFS) += gluster.o | 20 | |
46 | +block-obj-$(CONFIG_VXHS) += vxhs.o | 21 | - curl_multi_add_handle(s->multi, state->curl); |
47 | block-obj-$(CONFIG_LIBSSH2) += ssh.o | 22 | + if (curl_multi_add_handle(s->multi, state->curl) != CURLM_OK) { |
48 | block-obj-y += accounting.o dirty-bitmap.o | 23 | + state->acb[0] = NULL; |
49 | block-obj-y += write-threshold.o | 24 | + acb->ret = -EIO; |
50 | @@ -XXX,XX +XXX,XX @@ rbd.o-cflags := $(RBD_CFLAGS) | ||
51 | rbd.o-libs := $(RBD_LIBS) | ||
52 | gluster.o-cflags := $(GLUSTERFS_CFLAGS) | ||
53 | gluster.o-libs := $(GLUSTERFS_LIBS) | ||
54 | +vxhs.o-libs := $(VXHS_LIBS) | ||
55 | ssh.o-cflags := $(LIBSSH2_CFLAGS) | ||
56 | ssh.o-libs := $(LIBSSH2_LIBS) | ||
57 | block-obj-$(if $(CONFIG_BZIP2),m,n) += dmg-bz2.o | ||
58 | diff --git a/block/trace-events b/block/trace-events | ||
59 | index XXXXXXX..XXXXXXX 100644 | ||
60 | --- a/block/trace-events | ||
61 | +++ b/block/trace-events | ||
62 | @@ -XXX,XX +XXX,XX @@ qed_aio_write_data(void *s, void *acb, int ret, uint64_t offset, size_t len) "s | ||
63 | qed_aio_write_prefill(void *s, void *acb, uint64_t start, size_t len, uint64_t offset) "s %p acb %p start %"PRIu64" len %zu offset %"PRIu64 | ||
64 | qed_aio_write_postfill(void *s, void *acb, uint64_t start, size_t len, uint64_t offset) "s %p acb %p start %"PRIu64" len %zu offset %"PRIu64 | ||
65 | qed_aio_write_main(void *s, void *acb, int ret, uint64_t offset, size_t len) "s %p acb %p ret %d offset %"PRIu64" len %zu" | ||
66 | + | 25 | + |
67 | +# block/vxhs.c | 26 | + curl_clean_state(state); |
68 | +vxhs_iio_callback(int error) "ctx is NULL: error %d" | ||
69 | +vxhs_iio_callback_chnfail(int err, int error) "QNIO channel failed, no i/o %d, %d" | ||
70 | +vxhs_iio_callback_unknwn(int opcode, int err) "unexpected opcode %d, errno %d" | ||
71 | +vxhs_aio_rw_invalid(int req) "Invalid I/O request iodir %d" | ||
72 | +vxhs_aio_rw_ioerr(char *guid, int iodir, uint64_t size, uint64_t off, void *acb, int ret, int err) "IO ERROR (vDisk %s) FOR : Read/Write = %d size = %lu offset = %lu ACB = %p. Error = %d, errno = %d" | ||
73 | +vxhs_get_vdisk_stat_err(char *guid, int ret, int err) "vDisk (%s) stat ioctl failed, ret = %d, errno = %d" | ||
74 | +vxhs_get_vdisk_stat(char *vdisk_guid, uint64_t vdisk_size) "vDisk %s stat ioctl returned size %lu" | ||
75 | +vxhs_complete_aio(void *acb, uint64_t ret) "aio failed acb %p ret %ld" | ||
76 | +vxhs_parse_uri_filename(const char *filename) "URI passed via bdrv_parse_filename %s" | ||
77 | +vxhs_open_vdiskid(const char *vdisk_id) "Opening vdisk-id %s" | ||
78 | +vxhs_open_hostinfo(char *of_vsa_addr, int port) "Adding host %s:%d to BDRVVXHSState" | ||
79 | +vxhs_open_iio_open(const char *host) "Failed to connect to storage agent on host %s" | ||
80 | +vxhs_parse_uri_hostinfo(char *host, int port) "Host: IP %s, Port %d" | ||
81 | +vxhs_close(char *vdisk_guid) "Closing vdisk %s" | ||
82 | +vxhs_get_creds(const char *cacert, const char *client_key, const char *client_cert) "cacert %s, client_key %s, client_cert %s" | ||
83 | diff --git a/block/vxhs.c b/block/vxhs.c | ||
84 | new file mode 100644 | ||
85 | index XXXXXXX..XXXXXXX | ||
86 | --- /dev/null | ||
87 | +++ b/block/vxhs.c | ||
88 | @@ -XXX,XX +XXX,XX @@ | ||
89 | +/* | ||
90 | + * QEMU Block driver for Veritas HyperScale (VxHS) | ||
91 | + * | ||
92 | + * Copyright (c) 2017 Veritas Technologies LLC. | ||
93 | + * | ||
94 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
95 | + * See the COPYING file in the top-level directory. | ||
96 | + * | ||
97 | + */ | ||
98 | + | ||
99 | +#include "qemu/osdep.h" | ||
100 | +#include <qnio/qnio_api.h> | ||
101 | +#include <sys/param.h> | ||
102 | +#include "block/block_int.h" | ||
103 | +#include "qapi/qmp/qerror.h" | ||
104 | +#include "qapi/qmp/qdict.h" | ||
105 | +#include "qapi/qmp/qstring.h" | ||
106 | +#include "trace.h" | ||
107 | +#include "qemu/uri.h" | ||
108 | +#include "qapi/error.h" | ||
109 | +#include "qemu/uuid.h" | ||
110 | +#include "crypto/tlscredsx509.h" | ||
111 | + | ||
112 | +#define VXHS_OPT_FILENAME "filename" | ||
113 | +#define VXHS_OPT_VDISK_ID "vdisk-id" | ||
114 | +#define VXHS_OPT_SERVER "server" | ||
115 | +#define VXHS_OPT_HOST "host" | ||
116 | +#define VXHS_OPT_PORT "port" | ||
117 | + | ||
118 | +/* Only accessed under QEMU global mutex */ | ||
119 | +static uint32_t vxhs_ref; | ||
120 | + | ||
121 | +typedef enum { | ||
122 | + VDISK_AIO_READ, | ||
123 | + VDISK_AIO_WRITE, | ||
124 | +} VDISKAIOCmd; | ||
125 | + | ||
126 | +/* | ||
127 | + * HyperScale AIO callbacks structure | ||
128 | + */ | ||
129 | +typedef struct VXHSAIOCB { | ||
130 | + BlockAIOCB common; | ||
131 | + int err; | ||
132 | +} VXHSAIOCB; | ||
133 | + | ||
134 | +typedef struct VXHSvDiskHostsInfo { | ||
135 | + void *dev_handle; /* Device handle */ | ||
136 | + char *host; /* Host name or IP */ | ||
137 | + int port; /* Host's port number */ | ||
138 | +} VXHSvDiskHostsInfo; | ||
139 | + | ||
140 | +/* | ||
141 | + * Structure per vDisk maintained for state | ||
142 | + */ | ||
143 | +typedef struct BDRVVXHSState { | ||
144 | + VXHSvDiskHostsInfo vdisk_hostinfo; /* Per host info */ | ||
145 | + char *vdisk_guid; | ||
146 | + char *tlscredsid; /* tlscredsid */ | ||
147 | +} BDRVVXHSState; | ||
148 | + | ||
149 | +static void vxhs_complete_aio_bh(void *opaque) | ||
150 | +{ | ||
151 | + VXHSAIOCB *acb = opaque; | ||
152 | + BlockCompletionFunc *cb = acb->common.cb; | ||
153 | + void *cb_opaque = acb->common.opaque; | ||
154 | + int ret = 0; | ||
155 | + | ||
156 | + if (acb->err != 0) { | ||
157 | + trace_vxhs_complete_aio(acb, acb->err); | ||
158 | + ret = (-EIO); | ||
159 | + } | ||
160 | + | ||
161 | + qemu_aio_unref(acb); | ||
162 | + cb(cb_opaque, ret); | ||
163 | +} | ||
164 | + | ||
165 | +/* | ||
166 | + * Called from a libqnio thread | ||
167 | + */ | ||
168 | +static void vxhs_iio_callback(void *ctx, uint32_t opcode, uint32_t error) | ||
169 | +{ | ||
170 | + VXHSAIOCB *acb = NULL; | ||
171 | + | ||
172 | + switch (opcode) { | ||
173 | + case IRP_READ_REQUEST: | ||
174 | + case IRP_WRITE_REQUEST: | ||
175 | + | ||
176 | + /* | ||
177 | + * ctx is VXHSAIOCB* | ||
178 | + * ctx is NULL if error is QNIOERROR_CHANNEL_HUP | ||
179 | + */ | ||
180 | + if (ctx) { | ||
181 | + acb = ctx; | ||
182 | + } else { | ||
183 | + trace_vxhs_iio_callback(error); | ||
184 | + goto out; | ||
185 | + } | ||
186 | + | ||
187 | + if (error) { | ||
188 | + if (!acb->err) { | ||
189 | + acb->err = error; | ||
190 | + } | ||
191 | + trace_vxhs_iio_callback(error); | ||
192 | + } | ||
193 | + | ||
194 | + aio_bh_schedule_oneshot(bdrv_get_aio_context(acb->common.bs), | ||
195 | + vxhs_complete_aio_bh, acb); | ||
196 | + break; | ||
197 | + | ||
198 | + default: | ||
199 | + if (error == QNIOERROR_HUP) { | ||
200 | + /* | ||
201 | + * Channel failed, spontaneous notification, | ||
202 | + * not in response to I/O | ||
203 | + */ | ||
204 | + trace_vxhs_iio_callback_chnfail(error, errno); | ||
205 | + } else { | ||
206 | + trace_vxhs_iio_callback_unknwn(opcode, error); | ||
207 | + } | ||
208 | + break; | ||
209 | + } | ||
210 | +out: | ||
211 | + return; | ||
212 | +} | ||
213 | + | ||
214 | +static QemuOptsList runtime_opts = { | ||
215 | + .name = "vxhs", | ||
216 | + .head = QTAILQ_HEAD_INITIALIZER(runtime_opts.head), | ||
217 | + .desc = { | ||
218 | + { | ||
219 | + .name = VXHS_OPT_FILENAME, | ||
220 | + .type = QEMU_OPT_STRING, | ||
221 | + .help = "URI to the Veritas HyperScale image", | ||
222 | + }, | ||
223 | + { | ||
224 | + .name = VXHS_OPT_VDISK_ID, | ||
225 | + .type = QEMU_OPT_STRING, | ||
226 | + .help = "UUID of the VxHS vdisk", | ||
227 | + }, | ||
228 | + { | ||
229 | + .name = "tls-creds", | ||
230 | + .type = QEMU_OPT_STRING, | ||
231 | + .help = "ID of the TLS/SSL credentials to use", | ||
232 | + }, | ||
233 | + { /* end of list */ } | ||
234 | + }, | ||
235 | +}; | ||
236 | + | ||
237 | +static QemuOptsList runtime_tcp_opts = { | ||
238 | + .name = "vxhs_tcp", | ||
239 | + .head = QTAILQ_HEAD_INITIALIZER(runtime_tcp_opts.head), | ||
240 | + .desc = { | ||
241 | + { | ||
242 | + .name = VXHS_OPT_HOST, | ||
243 | + .type = QEMU_OPT_STRING, | ||
244 | + .help = "host address (ipv4 addresses)", | ||
245 | + }, | ||
246 | + { | ||
247 | + .name = VXHS_OPT_PORT, | ||
248 | + .type = QEMU_OPT_NUMBER, | ||
249 | + .help = "port number on which VxHSD is listening (default 9999)", | ||
250 | + .def_value_str = "9999" | ||
251 | + }, | ||
252 | + { /* end of list */ } | ||
253 | + }, | ||
254 | +}; | ||
255 | + | ||
256 | +/* | ||
257 | + * Parse incoming URI and populate *options with the host | ||
258 | + * and device information | ||
259 | + */ | ||
260 | +static int vxhs_parse_uri(const char *filename, QDict *options) | ||
261 | +{ | ||
262 | + URI *uri = NULL; | ||
263 | + char *port; | ||
264 | + int ret = 0; | ||
265 | + | ||
266 | + trace_vxhs_parse_uri_filename(filename); | ||
267 | + uri = uri_parse(filename); | ||
268 | + if (!uri || !uri->server || !uri->path) { | ||
269 | + uri_free(uri); | ||
270 | + return -EINVAL; | ||
271 | + } | ||
272 | + | ||
273 | + qdict_put(options, VXHS_OPT_SERVER".host", qstring_from_str(uri->server)); | ||
274 | + | ||
275 | + if (uri->port) { | ||
276 | + port = g_strdup_printf("%d", uri->port); | ||
277 | + qdict_put(options, VXHS_OPT_SERVER".port", qstring_from_str(port)); | ||
278 | + g_free(port); | ||
279 | + } | ||
280 | + | ||
281 | + qdict_put(options, "vdisk-id", qstring_from_str(uri->path)); | ||
282 | + | ||
283 | + trace_vxhs_parse_uri_hostinfo(uri->server, uri->port); | ||
284 | + uri_free(uri); | ||
285 | + | ||
286 | + return ret; | ||
287 | +} | ||
288 | + | ||
289 | +static void vxhs_parse_filename(const char *filename, QDict *options, | ||
290 | + Error **errp) | ||
291 | +{ | ||
292 | + if (qdict_haskey(options, "vdisk-id") || qdict_haskey(options, "server")) { | ||
293 | + error_setg(errp, "vdisk-id/server and a file name may not be specified " | ||
294 | + "at the same time"); | ||
295 | + return; | ||
296 | + } | ||
297 | + | ||
298 | + if (strstr(filename, "://")) { | ||
299 | + int ret = vxhs_parse_uri(filename, options); | ||
300 | + if (ret < 0) { | ||
301 | + error_setg(errp, "Invalid URI. URI should be of the form " | ||
302 | + " vxhs://<host_ip>:<port>/<vdisk-id>"); | ||
303 | + } | ||
304 | + } | ||
305 | +} | ||
306 | + | ||
307 | +static int vxhs_init_and_ref(void) | ||
308 | +{ | ||
309 | + if (vxhs_ref++ == 0) { | ||
310 | + if (iio_init(QNIO_VERSION, vxhs_iio_callback)) { | ||
311 | + return -ENODEV; | ||
312 | + } | ||
313 | + } | ||
314 | + return 0; | ||
315 | +} | ||
316 | + | ||
317 | +static void vxhs_unref(void) | ||
318 | +{ | ||
319 | + if (--vxhs_ref == 0) { | ||
320 | + iio_fini(); | ||
321 | + } | ||
322 | +} | ||
323 | + | ||
324 | +static void vxhs_get_tls_creds(const char *id, char **cacert, | ||
325 | + char **key, char **cert, Error **errp) | ||
326 | +{ | ||
327 | + Object *obj; | ||
328 | + QCryptoTLSCreds *creds; | ||
329 | + QCryptoTLSCredsX509 *creds_x509; | ||
330 | + | ||
331 | + obj = object_resolve_path_component( | ||
332 | + object_get_objects_root(), id); | ||
333 | + | ||
334 | + if (!obj) { | ||
335 | + error_setg(errp, "No TLS credentials with id '%s'", | ||
336 | + id); | ||
337 | + return; | ||
338 | + } | ||
339 | + | ||
340 | + creds_x509 = (QCryptoTLSCredsX509 *) | ||
341 | + object_dynamic_cast(obj, TYPE_QCRYPTO_TLS_CREDS_X509); | ||
342 | + | ||
343 | + if (!creds_x509) { | ||
344 | + error_setg(errp, "Object with id '%s' is not TLS credentials", | ||
345 | + id); | ||
346 | + return; | ||
347 | + } | ||
348 | + | ||
349 | + creds = &creds_x509->parent_obj; | ||
350 | + | ||
351 | + if (creds->endpoint != QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT) { | ||
352 | + error_setg(errp, | ||
353 | + "Expecting TLS credentials with a client endpoint"); | ||
354 | + return; | ||
355 | + } | ||
356 | + | ||
357 | + /* | ||
358 | + * Get the cacert, client_cert and client_key file names. | ||
359 | + */ | ||
360 | + if (!creds->dir) { | ||
361 | + error_setg(errp, "TLS object missing 'dir' property value"); | ||
362 | + return; | ||
363 | + } | ||
364 | + | ||
365 | + *cacert = g_strdup_printf("%s/%s", creds->dir, | ||
366 | + QCRYPTO_TLS_CREDS_X509_CA_CERT); | ||
367 | + *cert = g_strdup_printf("%s/%s", creds->dir, | ||
368 | + QCRYPTO_TLS_CREDS_X509_CLIENT_CERT); | ||
369 | + *key = g_strdup_printf("%s/%s", creds->dir, | ||
370 | + QCRYPTO_TLS_CREDS_X509_CLIENT_KEY); | ||
371 | +} | ||
372 | + | ||
373 | +static int vxhs_open(BlockDriverState *bs, QDict *options, | ||
374 | + int bdrv_flags, Error **errp) | ||
375 | +{ | ||
376 | + BDRVVXHSState *s = bs->opaque; | ||
377 | + void *dev_handlep; | ||
378 | + QDict *backing_options = NULL; | ||
379 | + QemuOpts *opts = NULL; | ||
380 | + QemuOpts *tcp_opts = NULL; | ||
381 | + char *of_vsa_addr = NULL; | ||
382 | + Error *local_err = NULL; | ||
383 | + const char *vdisk_id_opt; | ||
384 | + const char *server_host_opt; | ||
385 | + int ret = 0; | ||
386 | + char *cacert = NULL; | ||
387 | + char *client_key = NULL; | ||
388 | + char *client_cert = NULL; | ||
389 | + | ||
390 | + ret = vxhs_init_and_ref(); | ||
391 | + if (ret < 0) { | ||
392 | + ret = -EINVAL; | ||
393 | + goto out; | 27 | + goto out; |
394 | + } | 28 | + } |
395 | + | 29 | |
396 | + /* Create opts info from runtime_opts and runtime_tcp_opts list */ | 30 | /* Tell curl it needs to kick things off */ |
397 | + opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); | 31 | curl_multi_socket_action(s->multi, CURL_SOCKET_TIMEOUT, 0, &running); |
398 | + tcp_opts = qemu_opts_create(&runtime_tcp_opts, NULL, 0, &error_abort); | ||
399 | + | ||
400 | + qemu_opts_absorb_qdict(opts, options, &local_err); | ||
401 | + if (local_err) { | ||
402 | + ret = -EINVAL; | ||
403 | + goto out; | ||
404 | + } | ||
405 | + | ||
406 | + /* vdisk-id is the disk UUID */ | ||
407 | + vdisk_id_opt = qemu_opt_get(opts, VXHS_OPT_VDISK_ID); | ||
408 | + if (!vdisk_id_opt) { | ||
409 | + error_setg(&local_err, QERR_MISSING_PARAMETER, VXHS_OPT_VDISK_ID); | ||
410 | + ret = -EINVAL; | ||
411 | + goto out; | ||
412 | + } | ||
413 | + | ||
414 | + /* vdisk-id may contain a leading '/' */ | ||
415 | + if (strlen(vdisk_id_opt) > UUID_FMT_LEN + 1) { | ||
416 | + error_setg(&local_err, "vdisk-id cannot be more than %d characters", | ||
417 | + UUID_FMT_LEN); | ||
418 | + ret = -EINVAL; | ||
419 | + goto out; | ||
420 | + } | ||
421 | + | ||
422 | + s->vdisk_guid = g_strdup(vdisk_id_opt); | ||
423 | + trace_vxhs_open_vdiskid(vdisk_id_opt); | ||
424 | + | ||
425 | + /* get the 'server.' arguments */ | ||
426 | + qdict_extract_subqdict(options, &backing_options, VXHS_OPT_SERVER"."); | ||
427 | + | ||
428 | + qemu_opts_absorb_qdict(tcp_opts, backing_options, &local_err); | ||
429 | + if (local_err != NULL) { | ||
430 | + ret = -EINVAL; | ||
431 | + goto out; | ||
432 | + } | ||
433 | + | ||
434 | + server_host_opt = qemu_opt_get(tcp_opts, VXHS_OPT_HOST); | ||
435 | + if (!server_host_opt) { | ||
436 | + error_setg(&local_err, QERR_MISSING_PARAMETER, | ||
437 | + VXHS_OPT_SERVER"."VXHS_OPT_HOST); | ||
438 | + ret = -EINVAL; | ||
439 | + goto out; | ||
440 | + } | ||
441 | + | ||
442 | + if (strlen(server_host_opt) > MAXHOSTNAMELEN) { | ||
443 | + error_setg(&local_err, "server.host cannot be more than %d characters", | ||
444 | + MAXHOSTNAMELEN); | ||
445 | + ret = -EINVAL; | ||
446 | + goto out; | ||
447 | + } | ||
448 | + | ||
449 | + /* check if we got tls-creds via the --object argument */ | ||
450 | + s->tlscredsid = g_strdup(qemu_opt_get(opts, "tls-creds")); | ||
451 | + if (s->tlscredsid) { | ||
452 | + vxhs_get_tls_creds(s->tlscredsid, &cacert, &client_key, | ||
453 | + &client_cert, &local_err); | ||
454 | + if (local_err != NULL) { | ||
455 | + ret = -EINVAL; | ||
456 | + goto out; | ||
457 | + } | ||
458 | + trace_vxhs_get_creds(cacert, client_key, client_cert); | ||
459 | + } | ||
460 | + | ||
461 | + s->vdisk_hostinfo.host = g_strdup(server_host_opt); | ||
462 | + s->vdisk_hostinfo.port = g_ascii_strtoll(qemu_opt_get(tcp_opts, | ||
463 | + VXHS_OPT_PORT), | ||
464 | + NULL, 0); | ||
465 | + | ||
466 | + trace_vxhs_open_hostinfo(s->vdisk_hostinfo.host, | ||
467 | + s->vdisk_hostinfo.port); | ||
468 | + | ||
469 | + of_vsa_addr = g_strdup_printf("of://%s:%d", | ||
470 | + s->vdisk_hostinfo.host, | ||
471 | + s->vdisk_hostinfo.port); | ||
472 | + | ||
473 | + /* | ||
474 | + * Open qnio channel to storage agent if not opened before | ||
475 | + */ | ||
476 | + dev_handlep = iio_open(of_vsa_addr, s->vdisk_guid, 0, | ||
477 | + cacert, client_key, client_cert); | ||
478 | + if (dev_handlep == NULL) { | ||
479 | + trace_vxhs_open_iio_open(of_vsa_addr); | ||
480 | + ret = -ENODEV; | ||
481 | + goto out; | ||
482 | + } | ||
483 | + s->vdisk_hostinfo.dev_handle = dev_handlep; | ||
484 | + | ||
485 | +out: | ||
486 | + g_free(of_vsa_addr); | ||
487 | + QDECREF(backing_options); | ||
488 | + qemu_opts_del(tcp_opts); | ||
489 | + qemu_opts_del(opts); | ||
490 | + g_free(cacert); | ||
491 | + g_free(client_key); | ||
492 | + g_free(client_cert); | ||
493 | + | ||
494 | + if (ret < 0) { | ||
495 | + vxhs_unref(); | ||
496 | + error_propagate(errp, local_err); | ||
497 | + g_free(s->vdisk_hostinfo.host); | ||
498 | + g_free(s->vdisk_guid); | ||
499 | + g_free(s->tlscredsid); | ||
500 | + s->vdisk_guid = NULL; | ||
501 | + } | ||
502 | + | ||
503 | + return ret; | ||
504 | +} | ||
505 | + | ||
506 | +static const AIOCBInfo vxhs_aiocb_info = { | ||
507 | + .aiocb_size = sizeof(VXHSAIOCB) | ||
508 | +}; | ||
509 | + | ||
510 | +/* | ||
511 | + * This allocates QEMU-VXHS callback for each IO | ||
512 | + * and is passed to QNIO. When QNIO completes the work, | ||
513 | + * it will be passed back through the callback. | ||
514 | + */ | ||
515 | +static BlockAIOCB *vxhs_aio_rw(BlockDriverState *bs, int64_t sector_num, | ||
516 | + QEMUIOVector *qiov, int nb_sectors, | ||
517 | + BlockCompletionFunc *cb, void *opaque, | ||
518 | + VDISKAIOCmd iodir) | ||
519 | +{ | ||
520 | + VXHSAIOCB *acb = NULL; | ||
521 | + BDRVVXHSState *s = bs->opaque; | ||
522 | + size_t size; | ||
523 | + uint64_t offset; | ||
524 | + int iio_flags = 0; | ||
525 | + int ret = 0; | ||
526 | + void *dev_handle = s->vdisk_hostinfo.dev_handle; | ||
527 | + | ||
528 | + offset = sector_num * BDRV_SECTOR_SIZE; | ||
529 | + size = nb_sectors * BDRV_SECTOR_SIZE; | ||
530 | + acb = qemu_aio_get(&vxhs_aiocb_info, bs, cb, opaque); | ||
531 | + | ||
532 | + /* | ||
533 | + * Initialize VXHSAIOCB. | ||
534 | + */ | ||
535 | + acb->err = 0; | ||
536 | + | ||
537 | + iio_flags = IIO_FLAG_ASYNC; | ||
538 | + | ||
539 | + switch (iodir) { | ||
540 | + case VDISK_AIO_WRITE: | ||
541 | + ret = iio_writev(dev_handle, acb, qiov->iov, qiov->niov, | ||
542 | + offset, (uint64_t)size, iio_flags); | ||
543 | + break; | ||
544 | + case VDISK_AIO_READ: | ||
545 | + ret = iio_readv(dev_handle, acb, qiov->iov, qiov->niov, | ||
546 | + offset, (uint64_t)size, iio_flags); | ||
547 | + break; | ||
548 | + default: | ||
549 | + trace_vxhs_aio_rw_invalid(iodir); | ||
550 | + goto errout; | ||
551 | + } | ||
552 | + | ||
553 | + if (ret != 0) { | ||
554 | + trace_vxhs_aio_rw_ioerr(s->vdisk_guid, iodir, size, offset, | ||
555 | + acb, ret, errno); | ||
556 | + goto errout; | ||
557 | + } | ||
558 | + return &acb->common; | ||
559 | + | ||
560 | +errout: | ||
561 | + qemu_aio_unref(acb); | ||
562 | + return NULL; | ||
563 | +} | ||
564 | + | ||
565 | +static BlockAIOCB *vxhs_aio_readv(BlockDriverState *bs, | ||
566 | + int64_t sector_num, QEMUIOVector *qiov, | ||
567 | + int nb_sectors, | ||
568 | + BlockCompletionFunc *cb, void *opaque) | ||
569 | +{ | ||
570 | + return vxhs_aio_rw(bs, sector_num, qiov, nb_sectors, cb, | ||
571 | + opaque, VDISK_AIO_READ); | ||
572 | +} | ||
573 | + | ||
574 | +static BlockAIOCB *vxhs_aio_writev(BlockDriverState *bs, | ||
575 | + int64_t sector_num, QEMUIOVector *qiov, | ||
576 | + int nb_sectors, | ||
577 | + BlockCompletionFunc *cb, void *opaque) | ||
578 | +{ | ||
579 | + return vxhs_aio_rw(bs, sector_num, qiov, nb_sectors, | ||
580 | + cb, opaque, VDISK_AIO_WRITE); | ||
581 | +} | ||
582 | + | ||
583 | +static void vxhs_close(BlockDriverState *bs) | ||
584 | +{ | ||
585 | + BDRVVXHSState *s = bs->opaque; | ||
586 | + | ||
587 | + trace_vxhs_close(s->vdisk_guid); | ||
588 | + | ||
589 | + g_free(s->vdisk_guid); | ||
590 | + s->vdisk_guid = NULL; | ||
591 | + | ||
592 | + /* | ||
593 | + * Close vDisk device | ||
594 | + */ | ||
595 | + if (s->vdisk_hostinfo.dev_handle) { | ||
596 | + iio_close(s->vdisk_hostinfo.dev_handle); | ||
597 | + s->vdisk_hostinfo.dev_handle = NULL; | ||
598 | + } | ||
599 | + | ||
600 | + vxhs_unref(); | ||
601 | + | ||
602 | + /* | ||
603 | + * Free the dynamically allocated host string etc | ||
604 | + */ | ||
605 | + g_free(s->vdisk_hostinfo.host); | ||
606 | + g_free(s->tlscredsid); | ||
607 | + s->tlscredsid = NULL; | ||
608 | + s->vdisk_hostinfo.host = NULL; | ||
609 | + s->vdisk_hostinfo.port = 0; | ||
610 | +} | ||
611 | + | ||
612 | +static int64_t vxhs_get_vdisk_stat(BDRVVXHSState *s) | ||
613 | +{ | ||
614 | + int64_t vdisk_size = -1; | ||
615 | + int ret = 0; | ||
616 | + void *dev_handle = s->vdisk_hostinfo.dev_handle; | ||
617 | + | ||
618 | + ret = iio_ioctl(dev_handle, IOR_VDISK_STAT, &vdisk_size, 0); | ||
619 | + if (ret < 0) { | ||
620 | + trace_vxhs_get_vdisk_stat_err(s->vdisk_guid, ret, errno); | ||
621 | + return -EIO; | ||
622 | + } | ||
623 | + | ||
624 | + trace_vxhs_get_vdisk_stat(s->vdisk_guid, vdisk_size); | ||
625 | + return vdisk_size; | ||
626 | +} | ||
627 | + | ||
628 | +/* | ||
629 | + * Returns the size of vDisk in bytes. This is required | ||
630 | + * by QEMU block upper block layer so that it is visible | ||
631 | + * to guest. | ||
632 | + */ | ||
633 | +static int64_t vxhs_getlength(BlockDriverState *bs) | ||
634 | +{ | ||
635 | + BDRVVXHSState *s = bs->opaque; | ||
636 | + int64_t vdisk_size; | ||
637 | + | ||
638 | + vdisk_size = vxhs_get_vdisk_stat(s); | ||
639 | + if (vdisk_size < 0) { | ||
640 | + return -EIO; | ||
641 | + } | ||
642 | + | ||
643 | + return vdisk_size; | ||
644 | +} | ||
645 | + | ||
646 | +static BlockDriver bdrv_vxhs = { | ||
647 | + .format_name = "vxhs", | ||
648 | + .protocol_name = "vxhs", | ||
649 | + .instance_size = sizeof(BDRVVXHSState), | ||
650 | + .bdrv_file_open = vxhs_open, | ||
651 | + .bdrv_parse_filename = vxhs_parse_filename, | ||
652 | + .bdrv_close = vxhs_close, | ||
653 | + .bdrv_getlength = vxhs_getlength, | ||
654 | + .bdrv_aio_readv = vxhs_aio_readv, | ||
655 | + .bdrv_aio_writev = vxhs_aio_writev, | ||
656 | +}; | ||
657 | + | ||
658 | +static void bdrv_vxhs_init(void) | ||
659 | +{ | ||
660 | + bdrv_register(&bdrv_vxhs); | ||
661 | +} | ||
662 | + | ||
663 | +block_init(bdrv_vxhs_init); | ||
664 | diff --git a/configure b/configure | ||
665 | index XXXXXXX..XXXXXXX 100755 | ||
666 | --- a/configure | ||
667 | +++ b/configure | ||
668 | @@ -XXX,XX +XXX,XX @@ numa="" | ||
669 | tcmalloc="no" | ||
670 | jemalloc="no" | ||
671 | replication="yes" | ||
672 | +vxhs="" | ||
673 | |||
674 | supported_cpu="no" | ||
675 | supported_os="no" | ||
676 | @@ -XXX,XX +XXX,XX @@ for opt do | ||
677 | ;; | ||
678 | --enable-replication) replication="yes" | ||
679 | ;; | ||
680 | + --disable-vxhs) vxhs="no" | ||
681 | + ;; | ||
682 | + --enable-vxhs) vxhs="yes" | ||
683 | + ;; | ||
684 | *) | ||
685 | echo "ERROR: unknown option $opt" | ||
686 | echo "Try '$0 --help' for more information" | ||
687 | @@ -XXX,XX +XXX,XX @@ disabled with --disable-FEATURE, default is enabled if available: | ||
688 | xfsctl xfsctl support | ||
689 | qom-cast-debug cast debugging support | ||
690 | tools build qemu-io, qemu-nbd and qemu-image tools | ||
691 | + vxhs Veritas HyperScale vDisk backend support | ||
692 | |||
693 | NOTE: The object files are built at the place where configure is launched | ||
694 | EOF | ||
695 | @@ -XXX,XX +XXX,XX @@ if compile_prog "" "" ; then | ||
696 | fi | ||
697 | |||
698 | ########################################## | ||
699 | +# Veritas HyperScale block driver VxHS | ||
700 | +# Check if libvxhs is installed | ||
701 | + | ||
702 | +if test "$vxhs" != "no" ; then | ||
703 | + cat > $TMPC <<EOF | ||
704 | +#include <stdint.h> | ||
705 | +#include <qnio/qnio_api.h> | ||
706 | + | ||
707 | +void *vxhs_callback; | ||
708 | + | ||
709 | +int main(void) { | ||
710 | + iio_init(QNIO_VERSION, vxhs_callback); | ||
711 | + return 0; | ||
712 | +} | ||
713 | +EOF | ||
714 | + vxhs_libs="-lvxhs -lssl" | ||
715 | + if compile_prog "" "$vxhs_libs" ; then | ||
716 | + vxhs=yes | ||
717 | + else | ||
718 | + if test "$vxhs" = "yes" ; then | ||
719 | + feature_not_found "vxhs block device" "Install libvxhs See github" | ||
720 | + fi | ||
721 | + vxhs=no | ||
722 | + fi | ||
723 | +fi | ||
724 | + | ||
725 | +########################################## | ||
726 | # End of CC checks | ||
727 | # After here, no more $cc or $ld runs | ||
728 | |||
729 | @@ -XXX,XX +XXX,XX @@ echo "tcmalloc support $tcmalloc" | ||
730 | echo "jemalloc support $jemalloc" | ||
731 | echo "avx2 optimization $avx2_opt" | ||
732 | echo "replication support $replication" | ||
733 | +echo "VxHS block device $vxhs" | ||
734 | |||
735 | if test "$sdl_too_old" = "yes"; then | ||
736 | echo "-> Your SDL version is too old - please upgrade to have SDL support" | ||
737 | @@ -XXX,XX +XXX,XX @@ if test "$pthread_setname_np" = "yes" ; then | ||
738 | echo "CONFIG_PTHREAD_SETNAME_NP=y" >> $config_host_mak | ||
739 | fi | ||
740 | |||
741 | +if test "$vxhs" = "yes" ; then | ||
742 | + echo "CONFIG_VXHS=y" >> $config_host_mak | ||
743 | + echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak | ||
744 | +fi | ||
745 | + | ||
746 | if test "$tcg_interpreter" = "yes"; then | ||
747 | QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES" | ||
748 | elif test "$ARCH" = "sparc64" ; then | ||
749 | diff --git a/qapi/block-core.json b/qapi/block-core.json | ||
750 | index XXXXXXX..XXXXXXX 100644 | ||
751 | --- a/qapi/block-core.json | ||
752 | +++ b/qapi/block-core.json | ||
753 | @@ -XXX,XX +XXX,XX @@ | ||
754 | # | ||
755 | # Drivers that are supported in block device operations. | ||
756 | # | ||
757 | +# @vxhs: Since 2.10 | ||
758 | +# | ||
759 | # Since: 2.9 | ||
760 | ## | ||
761 | { 'enum': 'BlockdevDriver', | ||
762 | @@ -XXX,XX +XXX,XX @@ | ||
763 | 'host_device', 'http', 'https', 'iscsi', 'luks', 'nbd', 'nfs', | ||
764 | 'null-aio', 'null-co', 'parallels', 'qcow', 'qcow2', 'qed', | ||
765 | 'quorum', 'raw', 'rbd', 'replication', 'sheepdog', 'ssh', | ||
766 | - 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] } | ||
767 | + 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] } | ||
768 | |||
769 | ## | ||
770 | # @BlockdevOptionsFile: | ||
771 | @@ -XXX,XX +XXX,XX @@ | ||
772 | 'data': { '*offset': 'int', '*size': 'int' } } | ||
773 | |||
774 | ## | ||
775 | +# @BlockdevOptionsVxHS: | ||
776 | +# | ||
777 | +# Driver specific block device options for VxHS | ||
778 | +# | ||
779 | +# @vdisk-id: UUID of VxHS volume | ||
780 | +# @server: vxhs server IP, port | ||
781 | +# @tls-creds: TLS credentials ID | ||
782 | +# | ||
783 | +# Since: 2.10 | ||
784 | +## | ||
785 | +{ 'struct': 'BlockdevOptionsVxHS', | ||
786 | + 'data': { 'vdisk-id': 'str', | ||
787 | + 'server': 'InetSocketAddressBase', | ||
788 | + '*tls-creds': 'str' } } | ||
789 | + | ||
790 | +## | ||
791 | # @BlockdevOptions: | ||
792 | # | ||
793 | # Options for creating a block device. Many options are available for all | ||
794 | @@ -XXX,XX +XXX,XX @@ | ||
795 | 'vhdx': 'BlockdevOptionsGenericFormat', | ||
796 | 'vmdk': 'BlockdevOptionsGenericCOWFormat', | ||
797 | 'vpc': 'BlockdevOptionsGenericFormat', | ||
798 | - 'vvfat': 'BlockdevOptionsVVFAT' | ||
799 | + 'vvfat': 'BlockdevOptionsVVFAT', | ||
800 | + 'vxhs': 'BlockdevOptionsVxHS' | ||
801 | } } | ||
802 | |||
803 | ## | ||
804 | -- | 32 | -- |
805 | 2.9.3 | 33 | 2.21.0 |
806 | 34 | ||
807 | 35 | diff view generated by jsdifflib |
1 | From: Ashish Mittal <ashmit602@gmail.com> | 1 | From: Sergio Lopez <slp@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | These changes use a vxhs test server that is a part of the following | 3 | block_job_remove_all_bdrv() iterates through job->nodes, calling |
4 | repository: | 4 | bdrv_root_unref_child() for each entry. The call to the latter may |
5 | https://github.com/VeritasHyperScale/libqnio.git | 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. | ||
6 | 8 | ||
7 | Signed-off-by: Ashish Mittal <Ashish.Mittal@veritas.com> | 9 | To avoid this situation, update job->nodes head on each iteration to |
8 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | 10 | ensure that already freed entries are no longer linked to the list. |
9 | Reviewed-by: Jeff Cody <jcody@redhat.com> | 11 | |
10 | Signed-off-by: Jeff Cody <jcody@redhat.com> | 12 | RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1746631 |
11 | Message-id: 1491277689-24949-3-git-send-email-Ashish.Mittal@veritas.com | 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> | ||
12 | --- | 19 | --- |
13 | tests/qemu-iotests/common | 6 ++++++ | 20 | blockjob.c | 17 +++++++++++++---- |
14 | tests/qemu-iotests/common.config | 13 +++++++++++++ | 21 | 1 file changed, 13 insertions(+), 4 deletions(-) |
15 | tests/qemu-iotests/common.filter | 1 + | ||
16 | tests/qemu-iotests/common.rc | 19 +++++++++++++++++++ | ||
17 | 4 files changed, 39 insertions(+) | ||
18 | 22 | ||
19 | diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common | 23 | diff --git a/blockjob.c b/blockjob.c |
20 | index XXXXXXX..XXXXXXX 100644 | 24 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/tests/qemu-iotests/common | 25 | --- a/blockjob.c |
22 | +++ b/tests/qemu-iotests/common | 26 | +++ b/blockjob.c |
23 | @@ -XXX,XX +XXX,XX @@ check options | 27 | @@ -XXX,XX +XXX,XX @@ static const BdrvChildRole child_job = { |
24 | -ssh test ssh | 28 | |
25 | -nfs test nfs | 29 | void block_job_remove_all_bdrv(BlockJob *job) |
26 | -luks test luks | 30 | { |
27 | + -vxhs test vxhs | 31 | - GSList *l; |
28 | -xdiff graphical mode diff | 32 | - for (l = job->nodes; l; l = l->next) { |
29 | -nocache use O_DIRECT on backing file | 33 | + /* |
30 | -misalign misalign memory allocations | 34 | + * bdrv_root_unref_child() may reach child_job_[can_]set_aio_ctx(), |
31 | @@ -XXX,XX +XXX,XX @@ testlist options | 35 | + * which will also traverse job->nodes, so consume the list one by |
32 | xpand=false | 36 | + * one to make sure that such a concurrent access does not attempt |
33 | ;; | 37 | + * to process an already freed BdrvChild. |
34 | 38 | + */ | |
35 | + -vxhs) | 39 | + while (job->nodes) { |
36 | + IMGPROTO=vxhs | 40 | + GSList *l = job->nodes; |
37 | + xpand=false | 41 | BdrvChild *c = l->data; |
38 | + ;; | ||
39 | + | 42 | + |
40 | -ssh) | 43 | + job->nodes = l->next; |
41 | IMGPROTO=ssh | ||
42 | xpand=false | ||
43 | diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config | ||
44 | index XXXXXXX..XXXXXXX 100644 | ||
45 | --- a/tests/qemu-iotests/common.config | ||
46 | +++ b/tests/qemu-iotests/common.config | ||
47 | @@ -XXX,XX +XXX,XX @@ if [ -z "$QEMU_NBD_PROG" ]; then | ||
48 | export QEMU_NBD_PROG="`set_prog_path qemu-nbd`" | ||
49 | fi | ||
50 | |||
51 | +if [ -z "$QEMU_VXHS_PROG" ]; then | ||
52 | + export QEMU_VXHS_PROG="`set_prog_path qnio_server`" | ||
53 | +fi | ||
54 | + | 44 | + |
55 | _qemu_wrapper() | 45 | bdrv_op_unblock_all(c->bs, job->blocker); |
56 | { | 46 | bdrv_root_unref_child(c); |
57 | ( | 47 | + |
58 | @@ -XXX,XX +XXX,XX @@ _qemu_nbd_wrapper() | 48 | + g_slist_free_1(l); |
59 | ) | 49 | } |
50 | - g_slist_free(job->nodes); | ||
51 | - job->nodes = NULL; | ||
60 | } | 52 | } |
61 | 53 | ||
62 | +_qemu_vxhs_wrapper() | 54 | bool block_job_has_bdrv(BlockJob *job, BlockDriverState *bs) |
63 | +{ | ||
64 | + ( | ||
65 | + echo $BASHPID > "${TEST_DIR}/qemu-vxhs.pid" | ||
66 | + exec "$QEMU_VXHS_PROG" $QEMU_VXHS_OPTIONS "$@" | ||
67 | + ) | ||
68 | +} | ||
69 | + | ||
70 | export QEMU=_qemu_wrapper | ||
71 | export QEMU_IMG=_qemu_img_wrapper | ||
72 | export QEMU_IO=_qemu_io_wrapper | ||
73 | export QEMU_NBD=_qemu_nbd_wrapper | ||
74 | +export QEMU_VXHS=_qemu_vxhs_wrapper | ||
75 | |||
76 | QEMU_IMG_EXTRA_ARGS= | ||
77 | if [ "$IMGOPTSSYNTAX" = "true" ]; then | ||
78 | diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter | ||
79 | index XXXXXXX..XXXXXXX 100644 | ||
80 | --- a/tests/qemu-iotests/common.filter | ||
81 | +++ b/tests/qemu-iotests/common.filter | ||
82 | @@ -XXX,XX +XXX,XX @@ _filter_img_info() | ||
83 | -e "s#$TEST_DIR#TEST_DIR#g" \ | ||
84 | -e "s#$IMGFMT#IMGFMT#g" \ | ||
85 | -e 's#nbd://127.0.0.1:10810$#TEST_DIR/t.IMGFMT#g' \ | ||
86 | + -e 's#json.*vdisk-id.*vxhs"}}#TEST_DIR/t.IMGFMT#' \ | ||
87 | -e "/encrypted: yes/d" \ | ||
88 | -e "/cluster_size: [0-9]\\+/d" \ | ||
89 | -e "/table_size: [0-9]\\+/d" \ | ||
90 | diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc | ||
91 | index XXXXXXX..XXXXXXX 100644 | ||
92 | --- a/tests/qemu-iotests/common.rc | ||
93 | +++ b/tests/qemu-iotests/common.rc | ||
94 | @@ -XXX,XX +XXX,XX @@ else | ||
95 | elif [ "$IMGPROTO" = "nfs" ]; then | ||
96 | TEST_DIR="nfs://127.0.0.1/$TEST_DIR" | ||
97 | TEST_IMG=$TEST_DIR/t.$IMGFMT | ||
98 | + elif [ "$IMGPROTO" = "vxhs" ]; then | ||
99 | + TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT | ||
100 | + TEST_IMG="vxhs://127.0.0.1:9999/t.$IMGFMT" | ||
101 | else | ||
102 | TEST_IMG=$IMGPROTO:$TEST_DIR/t.$IMGFMT | ||
103 | fi | ||
104 | @@ -XXX,XX +XXX,XX @@ _make_test_img() | ||
105 | eval "$QEMU_NBD -v -t -b 127.0.0.1 -p 10810 -f $IMGFMT $TEST_IMG_FILE >/dev/null &" | ||
106 | sleep 1 # FIXME: qemu-nbd needs to be listening before we continue | ||
107 | fi | ||
108 | + | ||
109 | + # Start QNIO server on image directory for vxhs protocol | ||
110 | + if [ $IMGPROTO = "vxhs" ]; then | ||
111 | + eval "$QEMU_VXHS -d $TEST_DIR > /dev/null &" | ||
112 | + sleep 1 # Wait for server to come up. | ||
113 | + fi | ||
114 | } | ||
115 | |||
116 | _rm_test_img() | ||
117 | @@ -XXX,XX +XXX,XX @@ _cleanup_test_img() | ||
118 | fi | ||
119 | rm -f "$TEST_IMG_FILE" | ||
120 | ;; | ||
121 | + vxhs) | ||
122 | + if [ -f "${TEST_DIR}/qemu-vxhs.pid" ]; then | ||
123 | + local QEMU_VXHS_PID | ||
124 | + read QEMU_VXHS_PID < "${TEST_DIR}/qemu-vxhs.pid" | ||
125 | + kill ${QEMU_VXHS_PID} >/dev/null 2>&1 | ||
126 | + rm -f "${TEST_DIR}/qemu-vxhs.pid" | ||
127 | + fi | ||
128 | + rm -f "$TEST_IMG_FILE" | ||
129 | + ;; | ||
130 | + | ||
131 | file) | ||
132 | _rm_test_img "$TEST_DIR/t.$IMGFMT" | ||
133 | _rm_test_img "$TEST_DIR/t.$IMGFMT.orig" | ||
134 | -- | 55 | -- |
135 | 2.9.3 | 56 | 2.21.0 |
136 | 57 | ||
137 | 58 | diff view generated by jsdifflib |
1 | The protocol VXHS does not support image creation. Some tests expect | 1 | From: Maxim Levitsky <mlevitsk@redhat.com> |
---|---|---|---|
2 | to be able to create images through the protocol. Exclude VXHS from | ||
3 | these tests. | ||
4 | 2 | ||
5 | Signed-off-by: Jeff Cody <jcody@redhat.com> | 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> | ||
6 | --- | 38 | --- |
7 | tests/qemu-iotests/017 | 1 + | 39 | block/qcow2-cluster.c | 7 ++++--- |
8 | tests/qemu-iotests/020 | 1 + | 40 | 1 file changed, 4 insertions(+), 3 deletions(-) |
9 | tests/qemu-iotests/029 | 1 + | ||
10 | tests/qemu-iotests/073 | 1 + | ||
11 | tests/qemu-iotests/114 | 1 + | ||
12 | tests/qemu-iotests/130 | 1 + | ||
13 | tests/qemu-iotests/134 | 1 + | ||
14 | tests/qemu-iotests/156 | 1 + | ||
15 | tests/qemu-iotests/158 | 1 + | ||
16 | 9 files changed, 9 insertions(+) | ||
17 | 41 | ||
18 | diff --git a/tests/qemu-iotests/017 b/tests/qemu-iotests/017 | 42 | diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c |
19 | index XXXXXXX..XXXXXXX 100755 | 43 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/tests/qemu-iotests/017 | 44 | --- a/block/qcow2-cluster.c |
21 | +++ b/tests/qemu-iotests/017 | 45 | +++ b/block/qcow2-cluster.c |
22 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | 46 | @@ -XXX,XX +XXX,XX @@ static bool coroutine_fn do_perform_cow_encrypt(BlockDriverState *bs, |
23 | # Any format supporting backing files | 47 | assert(QEMU_IS_ALIGNED(offset_in_cluster, BDRV_SECTOR_SIZE)); |
24 | _supported_fmt qcow qcow2 vmdk qed | 48 | assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); |
25 | _supported_proto generic | 49 | assert(s->crypto); |
26 | +_unsupported_proto vxhs | 50 | - if (qcow2_co_encrypt(bs, cluster_offset, |
27 | _supported_os Linux | 51 | - src_cluster_offset + offset_in_cluster, |
28 | _unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" | 52 | - buffer, bytes) < 0) { |
29 | 53 | + if (qcow2_co_encrypt(bs, | |
30 | diff --git a/tests/qemu-iotests/020 b/tests/qemu-iotests/020 | 54 | + start_of_cluster(s, cluster_offset + offset_in_cluster), |
31 | index XXXXXXX..XXXXXXX 100755 | 55 | + src_cluster_offset + offset_in_cluster, |
32 | --- a/tests/qemu-iotests/020 | 56 | + buffer, bytes) < 0) { |
33 | +++ b/tests/qemu-iotests/020 | 57 | return false; |
34 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | 58 | } |
35 | # Any format supporting backing files | 59 | } |
36 | _supported_fmt qcow qcow2 vmdk qed | ||
37 | _supported_proto generic | ||
38 | +_unsupported_proto vxhs | ||
39 | _supported_os Linux | ||
40 | _unsupported_imgopts "subformat=monolithicFlat" \ | ||
41 | "subformat=twoGbMaxExtentFlat" \ | ||
42 | diff --git a/tests/qemu-iotests/029 b/tests/qemu-iotests/029 | ||
43 | index XXXXXXX..XXXXXXX 100755 | ||
44 | --- a/tests/qemu-iotests/029 | ||
45 | +++ b/tests/qemu-iotests/029 | ||
46 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
47 | # Any format supporting intenal snapshots | ||
48 | _supported_fmt qcow2 | ||
49 | _supported_proto generic | ||
50 | +_unsupported_proto vxhs | ||
51 | _supported_os Linux | ||
52 | # Internal snapshots are (currently) impossible with refcount_bits=1 | ||
53 | _unsupported_imgopts 'refcount_bits=1[^0-9]' | ||
54 | diff --git a/tests/qemu-iotests/073 b/tests/qemu-iotests/073 | ||
55 | index XXXXXXX..XXXXXXX 100755 | ||
56 | --- a/tests/qemu-iotests/073 | ||
57 | +++ b/tests/qemu-iotests/073 | ||
58 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
59 | |||
60 | _supported_fmt qcow2 | ||
61 | _supported_proto generic | ||
62 | +_unsupported_proto vxhs | ||
63 | _supported_os Linux | ||
64 | |||
65 | CLUSTER_SIZE=64k | ||
66 | diff --git a/tests/qemu-iotests/114 b/tests/qemu-iotests/114 | ||
67 | index XXXXXXX..XXXXXXX 100755 | ||
68 | --- a/tests/qemu-iotests/114 | ||
69 | +++ b/tests/qemu-iotests/114 | ||
70 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
71 | |||
72 | _supported_fmt qcow2 | ||
73 | _supported_proto generic | ||
74 | +_unsupported_proto vxhs | ||
75 | _supported_os Linux | ||
76 | |||
77 | |||
78 | diff --git a/tests/qemu-iotests/130 b/tests/qemu-iotests/130 | ||
79 | index XXXXXXX..XXXXXXX 100755 | ||
80 | --- a/tests/qemu-iotests/130 | ||
81 | +++ b/tests/qemu-iotests/130 | ||
82 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
83 | |||
84 | _supported_fmt qcow2 | ||
85 | _supported_proto generic | ||
86 | +_unsupported_proto vxhs | ||
87 | _supported_os Linux | ||
88 | |||
89 | qemu_comm_method="monitor" | ||
90 | diff --git a/tests/qemu-iotests/134 b/tests/qemu-iotests/134 | ||
91 | index XXXXXXX..XXXXXXX 100755 | ||
92 | --- a/tests/qemu-iotests/134 | ||
93 | +++ b/tests/qemu-iotests/134 | ||
94 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
95 | |||
96 | _supported_fmt qcow2 | ||
97 | _supported_proto generic | ||
98 | +_unsupported_proto vxhs | ||
99 | _supported_os Linux | ||
100 | |||
101 | |||
102 | diff --git a/tests/qemu-iotests/156 b/tests/qemu-iotests/156 | ||
103 | index XXXXXXX..XXXXXXX 100755 | ||
104 | --- a/tests/qemu-iotests/156 | ||
105 | +++ b/tests/qemu-iotests/156 | ||
106 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
107 | |||
108 | _supported_fmt qcow2 qed | ||
109 | _supported_proto generic | ||
110 | +_unsupported_proto vxhs | ||
111 | _supported_os Linux | ||
112 | |||
113 | # Create source disk | ||
114 | diff --git a/tests/qemu-iotests/158 b/tests/qemu-iotests/158 | ||
115 | index XXXXXXX..XXXXXXX 100755 | ||
116 | --- a/tests/qemu-iotests/158 | ||
117 | +++ b/tests/qemu-iotests/158 | ||
118 | @@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
119 | |||
120 | _supported_fmt qcow2 | ||
121 | _supported_proto generic | ||
122 | +_unsupported_proto vxhs | ||
123 | _supported_os Linux | ||
124 | |||
125 | |||
126 | -- | 60 | -- |
127 | 2.9.3 | 61 | 2.21.0 |
128 | 62 | ||
129 | 63 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Maxim Levitsky <mlevitsk@redhat.com> | |
2 | |||
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 |
1 | For the tests that use the common.qemu functions for running a QEMU | 1 | From: Maxim Levitsky <mlevitsk@redhat.com> |
---|---|---|---|
2 | process, _cleanup_qemu must be called in the exit function. | ||
3 | 2 | ||
4 | If it is not, if the qemu process aborts, then not all of the droppings | 3 | Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> |
5 | are cleaned up (e.g. pidfile, fifos). | 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 | ||
6 | 15 | ||
7 | This updates those tests that did not have a cleanup in qemu-iotests. | 16 | diff --git a/tests/qemu-iotests/263 b/tests/qemu-iotests/263 |
8 | 17 | new file mode 100755 | |
9 | (I swapped spaces for tabs in test 102 as well) | 18 | index XXXXXXX..XXXXXXX |
10 | 19 | --- /dev/null | |
11 | Reported-by: Eric Blake <eblake@redhat.com> | 20 | +++ b/tests/qemu-iotests/263 |
12 | Reviewed-by: Eric Blake <eblake@redhat.com> | 21 | @@ -XXX,XX +XXX,XX @@ |
13 | Signed-off-by: Jeff Cody <jcody@redhat.com> | 22 | +#!/usr/bin/env bash |
14 | Message-id: d59c2f6ad6c1da8b9b3c7f357c94a7122ccfc55a.1492544096.git.jcody@redhat.com | 23 | +# |
15 | --- | 24 | +# Test encrypted write that crosses cluster boundary of two unallocated clusters |
16 | tests/qemu-iotests/028 | 1 + | 25 | +# Based on 188 |
17 | tests/qemu-iotests/094 | 11 ++++++++--- | 26 | +# |
18 | tests/qemu-iotests/102 | 5 +++-- | 27 | +# Copyright (C) 2019 Red Hat, Inc. |
19 | tests/qemu-iotests/109 | 1 + | 28 | +# |
20 | tests/qemu-iotests/117 | 1 + | 29 | +# This program is free software; you can redistribute it and/or modify |
21 | tests/qemu-iotests/130 | 1 + | 30 | +# it under the terms of the GNU General Public License as published by |
22 | tests/qemu-iotests/140 | 1 + | 31 | +# the Free Software Foundation; either version 2 of the License, or |
23 | tests/qemu-iotests/141 | 1 + | 32 | +# (at your option) any later version. |
24 | tests/qemu-iotests/143 | 1 + | 33 | +# |
25 | tests/qemu-iotests/156 | 1 + | 34 | +# This program is distributed in the hope that it will be useful, |
26 | 10 files changed, 19 insertions(+), 5 deletions(-) | 35 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
27 | 36 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
28 | diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028 | 37 | +# GNU General Public License for more details. |
29 | index XXXXXXX..XXXXXXX 100755 | 38 | +# |
30 | --- a/tests/qemu-iotests/028 | 39 | +# You should have received a copy of the GNU General Public License |
31 | +++ b/tests/qemu-iotests/028 | 40 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
32 | @@ -XXX,XX +XXX,XX @@ status=1 # failure is the default! | 41 | +# |
33 | 42 | + | |
34 | _cleanup() | 43 | +# creator |
35 | { | 44 | +owner=mlevitsk@redhat.com |
36 | + _cleanup_qemu | 45 | + |
37 | rm -f "${TEST_IMG}.copy" | 46 | +seq=`basename $0` |
38 | _cleanup_test_img | 47 | +echo "QA output created by $seq" |
39 | } | 48 | + |
40 | diff --git a/tests/qemu-iotests/094 b/tests/qemu-iotests/094 | 49 | +status=1 # failure is the default! |
41 | index XXXXXXX..XXXXXXX 100755 | 50 | + |
42 | --- a/tests/qemu-iotests/094 | ||
43 | +++ b/tests/qemu-iotests/094 | ||
44 | @@ -XXX,XX +XXX,XX @@ echo "QA output created by $seq" | ||
45 | here="$PWD" | ||
46 | status=1 # failure is the default! | ||
47 | |||
48 | -trap "exit \$status" 0 1 2 3 15 | ||
49 | +_cleanup() | 51 | +_cleanup() |
50 | +{ | 52 | +{ |
51 | + _cleanup_qemu | 53 | + _cleanup_test_img |
52 | + _cleanup_test_img | 54 | +} |
53 | + rm -f "$TEST_DIR/source.$IMGFMT" | 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 | + | ||
54 | +} | 87 | +} |
55 | + | 88 | + |
56 | +trap "_cleanup; exit \$status" 0 1 2 3 15 | 89 | + |
57 | 90 | +echo | |
58 | # get standard environment, filters and checks | 91 | +echo "testing LUKS qcow2 encryption" |
59 | . ./common.rc | 92 | +echo |
60 | @@ -XXX,XX +XXX,XX @@ _send_qemu_cmd $QEMU_HANDLE \ | 93 | + |
61 | 94 | +_make_test_img --object $SECRET -o "encrypt.format=luks,encrypt.key-secret=sec0,encrypt.iter-time=10,cluster_size=64K" $size | |
62 | wait=1 _cleanup_qemu | 95 | +_run_test "driver=$IMGFMT,encrypt.key-secret=sec0,file.filename=$TEST_IMG" |
63 | 96 | +_cleanup_test_img | |
64 | -_cleanup_test_img | 97 | + |
65 | -rm -f "$TEST_DIR/source.$IMGFMT" | 98 | +echo |
66 | 99 | +echo "testing legacy AES qcow2 encryption" | |
67 | # success, all done | 100 | +echo |
68 | echo '*** done' | 101 | + |
69 | diff --git a/tests/qemu-iotests/102 b/tests/qemu-iotests/102 | 102 | + |
70 | index XXXXXXX..XXXXXXX 100755 | 103 | +_make_test_img --object $SECRET -o "encrypt.format=aes,encrypt.key-secret=sec0,cluster_size=64K" $size |
71 | --- a/tests/qemu-iotests/102 | 104 | +_run_test "driver=$IMGFMT,encrypt.key-secret=sec0,file.filename=$TEST_IMG" |
72 | +++ b/tests/qemu-iotests/102 | 105 | +_cleanup_test_img |
73 | @@ -XXX,XX +XXX,XX @@ seq=$(basename $0) | 106 | + |
74 | echo "QA output created by $seq" | 107 | + |
75 | 108 | + | |
76 | here=$PWD | 109 | +# success, all done |
77 | -status=1 # failure is the default! | 110 | +echo "*** done" |
78 | +status=1 # failure is the default! | 111 | +rm -f $seq.full |
79 | 112 | +status=0 | |
80 | _cleanup() | 113 | diff --git a/tests/qemu-iotests/263.out b/tests/qemu-iotests/263.out |
81 | { | 114 | new file mode 100644 |
82 | - _cleanup_test_img | 115 | index XXXXXXX..XXXXXXX |
83 | + _cleanup_qemu | 116 | --- /dev/null |
84 | + _cleanup_test_img | 117 | +++ b/tests/qemu-iotests/263.out |
85 | } | 118 | @@ -XXX,XX +XXX,XX @@ |
86 | trap "_cleanup; exit \$status" 0 1 2 3 15 | 119 | +QA output created by 263 |
87 | 120 | + | |
88 | diff --git a/tests/qemu-iotests/109 b/tests/qemu-iotests/109 | 121 | +testing LUKS qcow2 encryption |
89 | index XXXXXXX..XXXXXXX 100755 | 122 | + |
90 | --- a/tests/qemu-iotests/109 | 123 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 encrypt.format=luks encrypt.key-secret=sec0 encrypt.iter-time=10 |
91 | +++ b/tests/qemu-iotests/109 | 124 | +== reading the whole image == |
92 | @@ -XXX,XX +XXX,XX @@ status=1 # failure is the default! | 125 | +read 1048576/1048576 bytes at offset 0 |
93 | 126 | +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | |
94 | _cleanup() | 127 | + |
95 | { | 128 | +== write two 512 byte sectors on a cluster boundary == |
96 | + _cleanup_qemu | 129 | +wrote 1024/1024 bytes at offset 65024 |
97 | rm -f $TEST_IMG.src | 130 | +1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) |
98 | _cleanup_test_img | 131 | + |
99 | } | 132 | +== verify that the rest of the image is not changed == |
100 | diff --git a/tests/qemu-iotests/117 b/tests/qemu-iotests/117 | 133 | +read 65024/65024 bytes at offset 0 |
101 | index XXXXXXX..XXXXXXX 100755 | 134 | +63.500 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) |
102 | --- a/tests/qemu-iotests/117 | 135 | +read 1024/1024 bytes at offset 65024 |
103 | +++ b/tests/qemu-iotests/117 | 136 | +1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) |
104 | @@ -XXX,XX +XXX,XX @@ status=1 # failure is the default! | 137 | +read 982528/982528 bytes at offset 66048 |
105 | 138 | +959.500 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | |
106 | _cleanup() | 139 | + |
107 | { | 140 | +testing legacy AES qcow2 encryption |
108 | + _cleanup_qemu | 141 | + |
109 | _cleanup_test_img | 142 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 encrypt.format=aes encrypt.key-secret=sec0 |
110 | } | 143 | +== reading the whole image == |
111 | trap "_cleanup; exit \$status" 0 1 2 3 15 | 144 | +read 1048576/1048576 bytes at offset 0 |
112 | diff --git a/tests/qemu-iotests/130 b/tests/qemu-iotests/130 | 145 | +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) |
113 | index XXXXXXX..XXXXXXX 100755 | 146 | + |
114 | --- a/tests/qemu-iotests/130 | 147 | +== write two 512 byte sectors on a cluster boundary == |
115 | +++ b/tests/qemu-iotests/130 | 148 | +wrote 1024/1024 bytes at offset 65024 |
116 | @@ -XXX,XX +XXX,XX @@ status=1 # failure is the default! | 149 | +1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) |
117 | 150 | + | |
118 | _cleanup() | 151 | +== verify that the rest of the image is not changed == |
119 | { | 152 | +read 65024/65024 bytes at offset 0 |
120 | + _cleanup_qemu | 153 | +63.500 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) |
121 | _cleanup_test_img | 154 | +read 1024/1024 bytes at offset 65024 |
122 | } | 155 | +1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) |
123 | trap "_cleanup; exit \$status" 0 1 2 3 15 | 156 | +read 982528/982528 bytes at offset 66048 |
124 | diff --git a/tests/qemu-iotests/140 b/tests/qemu-iotests/140 | 157 | +959.500 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) |
125 | index XXXXXXX..XXXXXXX 100755 | 158 | +*** done |
126 | --- a/tests/qemu-iotests/140 | 159 | diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group |
127 | +++ b/tests/qemu-iotests/140 | 160 | index XXXXXXX..XXXXXXX 100644 |
128 | @@ -XXX,XX +XXX,XX @@ status=1 # failure is the default! | 161 | --- a/tests/qemu-iotests/group |
129 | 162 | +++ b/tests/qemu-iotests/group | |
130 | _cleanup() | 163 | @@ -XXX,XX +XXX,XX @@ |
131 | { | 164 | 257 rw |
132 | + _cleanup_qemu | 165 | 258 rw quick |
133 | _cleanup_test_img | 166 | 262 rw quick migration |
134 | rm -f "$TEST_DIR/nbd" | 167 | +263 rw quick |
135 | } | 168 | 265 rw auto quick |
136 | diff --git a/tests/qemu-iotests/141 b/tests/qemu-iotests/141 | 169 | 266 rw quick |
137 | index XXXXXXX..XXXXXXX 100755 | ||
138 | --- a/tests/qemu-iotests/141 | ||
139 | +++ b/tests/qemu-iotests/141 | ||
140 | @@ -XXX,XX +XXX,XX @@ status=1 # failure is the default! | ||
141 | |||
142 | _cleanup() | ||
143 | { | ||
144 | + _cleanup_qemu | ||
145 | _cleanup_test_img | ||
146 | rm -f "$TEST_DIR/{b,m,o}.$IMGFMT" | ||
147 | } | ||
148 | diff --git a/tests/qemu-iotests/143 b/tests/qemu-iotests/143 | ||
149 | index XXXXXXX..XXXXXXX 100755 | ||
150 | --- a/tests/qemu-iotests/143 | ||
151 | +++ b/tests/qemu-iotests/143 | ||
152 | @@ -XXX,XX +XXX,XX @@ status=1 # failure is the default! | ||
153 | |||
154 | _cleanup() | ||
155 | { | ||
156 | + _cleanup_qemu | ||
157 | rm -f "$TEST_DIR/nbd" | ||
158 | } | ||
159 | trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
160 | diff --git a/tests/qemu-iotests/156 b/tests/qemu-iotests/156 | ||
161 | index XXXXXXX..XXXXXXX 100755 | ||
162 | --- a/tests/qemu-iotests/156 | ||
163 | +++ b/tests/qemu-iotests/156 | ||
164 | @@ -XXX,XX +XXX,XX @@ status=1 # failure is the default! | ||
165 | |||
166 | _cleanup() | ||
167 | { | ||
168 | + _cleanup_qemu | ||
169 | rm -f "$TEST_IMG{,.target}{,.backing,.overlay}" | ||
170 | } | ||
171 | trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
172 | -- | 170 | -- |
173 | 2.9.3 | 171 | 2.21.0 |
174 | 172 | ||
175 | 173 | diff view generated by jsdifflib |