1 | The following changes since commit 98b2faeaee96ab084d0b1669918688d8895c155f: | 1 | The following changes since commit 9c125d17e9402c232c46610802e5931b3639d77b: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging (2017-02-10 18:07:02 +0000) | 3 | Merge tag 'pull-tcg-20220420' of https://gitlab.com/rth7680/qemu into staging (2022-04-20 16:43:11 -0700) |
4 | 4 | ||
5 | are available in the git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | git://github.com/XanClic/qemu.git tags/pull-block-2017-02-12 | 7 | https://gitlab.com/stefanha/qemu.git tags/block-pull-request |
8 | 8 | ||
9 | for you to fetch changes up to 10d6eda1926804a09aa0710ca62933087813de0b: | 9 | for you to fetch changes up to d45c83328feab2e4083991693160f0a417cfd9b0: |
10 | 10 | ||
11 | qemu-img: Avoid setting ret to unused value in img_convert() (2017-02-12 00:56:32 +0100) | 11 | virtiofsd: Add docs/helper for killpriv_v2/no_killpriv_v2 option (2022-04-21 12:05:15 +0200) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Block patches | 14 | Pull request |
15 | |||
16 | Small contrib/vhost-user-blk, contrib/vhost-user-scsi, and tools/virtiofsd | ||
17 | improvements. | ||
15 | 18 | ||
16 | ---------------------------------------------------------------- | 19 | ---------------------------------------------------------------- |
17 | Alberto Garcia (2): | ||
18 | qcow2: Optimize the refcount-block overlap check | ||
19 | qemu-io: don't allow I/O operations larger than BDRV_REQUEST_MAX_BYTES | ||
20 | 20 | ||
21 | Daniel P. Berrange (1): | 21 | Liu Yiding (1): |
22 | iotests: record separate timings per format,protocol pair | 22 | virtiofsd: Add docs/helper for killpriv_v2/no_killpriv_v2 option |
23 | 23 | ||
24 | Dou Liyang (2): | 24 | Sakshi Kaushik (1): |
25 | block/qapi: reduce the coupling between the bdrv_query_stats and bdrv_query_bds_stats | 25 | Implements Backend Program conventions for vhost-user-scsi |
26 | block/qapi: reduce the execution time of qmp_query_blockstats | ||
27 | 26 | ||
28 | Fam Zheng (2): | 27 | Stefan Hajnoczi (1): |
29 | qapi: Tweak error message of bdrv_query_image_info | 28 | contrib/vhost-user-blk: add missing GOptionEntry NULL terminator |
30 | iotests: Fix reference output for 059 | ||
31 | 29 | ||
32 | Jeff Cody (3): | 30 | docs/tools/virtiofsd.rst | 5 ++ |
33 | block: check full backing filename when searching protocol filenames | 31 | contrib/vhost-user-blk/vhost-user-blk.c | 3 +- |
34 | qemu-iotests: Don't create fifos / pidfiles with protocol paths | 32 | contrib/vhost-user-scsi/vhost-user-scsi.c | 77 +++++++++++++++-------- |
35 | qemu-iotest: test to lookup protocol-based image with relative backing | 33 | tools/virtiofsd/helper.c | 3 + |
34 | 4 files changed, 62 insertions(+), 26 deletions(-) | ||
36 | 35 | ||
37 | Max Reitz (1): | 36 | -- |
38 | qemu-img: Improve commit invalid base message | 37 | 2.35.1 |
39 | |||
40 | Nir Soffer (3): | ||
41 | qemu-io: Return non-zero exit code on failure | ||
42 | qemu-iotests: Add _unsupported_fmt helper | ||
43 | qemu-io: Add failure regression tests | ||
44 | |||
45 | Peter Lieven (2): | ||
46 | block/nfs: fix NULL pointer dereference in URI parsing | ||
47 | block/nfs: fix naming of runtime opts | ||
48 | |||
49 | Peter Maydell (2): | ||
50 | qemu-img: Use qemu_strtoul() rather than raw strtoul() | ||
51 | qemu-img: Avoid setting ret to unused value in img_convert() | ||
52 | |||
53 | QingFeng Hao (2): | ||
54 | iotests: Fix a problem in common.filter | ||
55 | block/vmdk: Fix the endian problem of buf_len and lba | ||
56 | |||
57 | Vladimir Sementsov-Ogievskiy (1): | ||
58 | block: bdrv_invalidate_cache: invalidate children first | ||
59 | |||
60 | tests/qemu-iotests/Makefile | 2 +- | ||
61 | block/qcow2.h | 1 + | ||
62 | block.c | 24 +++++++--- | ||
63 | block/nfs.c | 49 ++++++++++---------- | ||
64 | block/qapi.c | 99 +++++++++++++++++----------------------- | ||
65 | block/qcow2-refcount.c | 24 +++++++++- | ||
66 | block/qcow2.c | 1 + | ||
67 | block/vmdk.c | 4 +- | ||
68 | qemu-img.c | 44 +++++++++--------- | ||
69 | qemu-io-cmds.c | 20 +++++--- | ||
70 | qemu-io.c | 8 +++- | ||
71 | tests/qemu-iotests/.gitignore | 2 +- | ||
72 | tests/qemu-iotests/059.out | 5 +- | ||
73 | tests/qemu-iotests/070.out | 1 - | ||
74 | tests/qemu-iotests/075.out | 7 --- | ||
75 | tests/qemu-iotests/076.out | 3 -- | ||
76 | tests/qemu-iotests/078.out | 6 --- | ||
77 | tests/qemu-iotests/080.out | 18 -------- | ||
78 | tests/qemu-iotests/083.out | 17 ------- | ||
79 | tests/qemu-iotests/088.out | 6 --- | ||
80 | tests/qemu-iotests/092.out | 12 ----- | ||
81 | tests/qemu-iotests/116.out | 7 --- | ||
82 | tests/qemu-iotests/131.out | 1 - | ||
83 | tests/qemu-iotests/140.out | 1 - | ||
84 | tests/qemu-iotests/173 | 97 +++++++++++++++++++++++++++++++++++++++ | ||
85 | tests/qemu-iotests/173.out | 12 +++++ | ||
86 | tests/qemu-iotests/174 | 59 ++++++++++++++++++++++++ | ||
87 | tests/qemu-iotests/174.out | 7 +++ | ||
88 | tests/qemu-iotests/check | 12 +++-- | ||
89 | tests/qemu-iotests/common.config | 6 ++- | ||
90 | tests/qemu-iotests/common.filter | 2 +- | ||
91 | tests/qemu-iotests/common.qemu | 10 ++-- | ||
92 | tests/qemu-iotests/common.rc | 17 +++++-- | ||
93 | tests/qemu-iotests/group | 2 + | ||
94 | 34 files changed, 366 insertions(+), 220 deletions(-) | ||
95 | create mode 100755 tests/qemu-iotests/173 | ||
96 | create mode 100644 tests/qemu-iotests/173.out | ||
97 | create mode 100755 tests/qemu-iotests/174 | ||
98 | create mode 100644 tests/qemu-iotests/174.out | ||
99 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: QingFeng Hao <haoqf@linux.vnet.ibm.com> | ||
2 | 1 | ||
3 | If TEST_DIR is set to /tmp, test case 144 will fail. The reason is that | ||
4 | TEST_DIR resembles 144's test image name tmp.qcow2. | ||
5 | When 144 is testing $TEST_DIR/tmp.qcow2, it wants to replace | ||
6 | $TEST_DIR/tmp.qcow2 to TEST_DIR/tmp.qcow2, but actually it will fail | ||
7 | and get TEST_DIRTEST_DIR.qcow2 in this case. | ||
8 | The fix is just to modify the code to replace $TEST_DIR/ with TEST_DIR/. | ||
9 | |||
10 | Signed-off-by: QingFeng Hao <haoqf@linux.vnet.ibm.com> | ||
11 | Message-id: 20161216054723.96055-2-haoqf@linux.vnet.ibm.com | ||
12 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
13 | [mreitz: Fixed commit message and dropped superfluous escaping] | ||
14 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
15 | --- | ||
16 | tests/qemu-iotests/common.filter | 2 +- | ||
17 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
18 | |||
19 | diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/tests/qemu-iotests/common.filter | ||
22 | +++ b/tests/qemu-iotests/common.filter | ||
23 | @@ -XXX,XX +XXX,XX @@ _filter_generated_node_ids() | ||
24 | # replace occurrences of the actual TEST_DIR value with TEST_DIR | ||
25 | _filter_testdir() | ||
26 | { | ||
27 | - sed -e "s#$TEST_DIR#TEST_DIR#g" | ||
28 | + sed -e "s#$TEST_DIR/#TEST_DIR/#g" | ||
29 | } | ||
30 | |||
31 | # replace occurrences of the actual IMGFMT value with IMGFMT | ||
32 | -- | ||
33 | 2.11.0 | ||
34 | |||
35 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | When trying to invoke qemu-img commit with a base image file name that | ||
2 | is not part of the top image's backing chain, the user receives a rather | ||
3 | plain "Base not found" error message. This is not really helpful because | ||
4 | it does not explain what "not found" means, potentially leaving the user | ||
5 | wondering why qemu cannot find a file despite it clearly existing in the | ||
6 | file system. | ||
7 | 1 | ||
8 | Improve the error message by clarifying that "not found" means "not | ||
9 | found in the top image's backing chain". | ||
10 | |||
11 | Reported-by: Ala Hino <ahino@redhat.com> | ||
12 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
13 | Message-id: 20161201020508.24417-1-mreitz@redhat.com | ||
14 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
15 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
16 | --- | ||
17 | qemu-img.c | 4 +++- | ||
18 | 1 file changed, 3 insertions(+), 1 deletion(-) | ||
19 | |||
20 | diff --git a/qemu-img.c b/qemu-img.c | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/qemu-img.c | ||
23 | +++ b/qemu-img.c | ||
24 | @@ -XXX,XX +XXX,XX @@ static int img_commit(int argc, char **argv) | ||
25 | if (base) { | ||
26 | base_bs = bdrv_find_backing_image(bs, base); | ||
27 | if (!base_bs) { | ||
28 | - error_setg(&local_err, QERR_BASE_NOT_FOUND, base); | ||
29 | + error_setg(&local_err, | ||
30 | + "Did not find '%s' in the backing chain of '%s'", | ||
31 | + base, filename); | ||
32 | goto done; | ||
33 | } | ||
34 | } else { | ||
35 | -- | ||
36 | 2.11.0 | ||
37 | |||
38 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Fam Zheng <famz@redhat.com> | ||
2 | 1 | ||
3 | @bs doesn't always have a device name, such as when it comes from | ||
4 | "qemu-img info". Report file name instead. | ||
5 | |||
6 | Signed-off-by: Fam Zheng <famz@redhat.com> | ||
7 | Message-id: 20170119130759.28319-2-famz@redhat.com | ||
8 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
9 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
10 | --- | ||
11 | block/qapi.c | 4 ++-- | ||
12 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
13 | |||
14 | diff --git a/block/qapi.c b/block/qapi.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/block/qapi.c | ||
17 | +++ b/block/qapi.c | ||
18 | @@ -XXX,XX +XXX,XX @@ void bdrv_query_image_info(BlockDriverState *bs, | ||
19 | |||
20 | size = bdrv_getlength(bs); | ||
21 | if (size < 0) { | ||
22 | - error_setg_errno(errp, -size, "Can't get size of device '%s'", | ||
23 | - bdrv_get_device_name(bs)); | ||
24 | + error_setg_errno(errp, -size, "Can't get image size '%s'", | ||
25 | + bs->exact_filename); | ||
26 | goto out; | ||
27 | } | ||
28 | |||
29 | -- | ||
30 | 2.11.0 | ||
31 | |||
32 | diff view generated by jsdifflib |
1 | From: Dou Liyang <douly.fnst@cn.fujitsu.com> | 1 | From: Sakshi Kaushik <sakshikaushik717@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | The bdrv_query_stats and bdrv_query_bds_stats functions need to call | 3 | Signed-off-by: Sakshi Kaushik <sakshikaushik717@gmail.com> |
4 | each other, that increases the coupling. it also makes the program | 4 | Message-id: 20220406162410.8536-1-sakshikaushik717@gmail.com |
5 | complicated and makes some unnecessary tests. | ||
6 | 5 | ||
7 | Remove the call from bdrv_query_bds_stats to bdrv_query_stats, just | 6 | [Name the iSCSI URL long option --iscsi-uri instead of --iscsi_uri for |
8 | take some recursion to make it clearly. | 7 | consistency, fix --fd which was rejected due to an outdated |
8 | --socket-path check, and add missing entries[] terminator. | ||
9 | --Stefan] | ||
9 | 10 | ||
10 | Avoid testing whether the blk is NULL during querying the bds stats. | 11 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
11 | It is unnecessary. | 12 | --- |
13 | contrib/vhost-user-scsi/vhost-user-scsi.c | 77 +++++++++++++++-------- | ||
14 | 1 file changed, 52 insertions(+), 25 deletions(-) | ||
12 | 15 | ||
13 | Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com> | 16 | diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c b/contrib/vhost-user-scsi/vhost-user-scsi.c |
14 | Message-id: 1484467275-27919-2-git-send-email-douly.fnst@cn.fujitsu.com | ||
15 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | ||
16 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
17 | --- | ||
18 | block/qapi.c | 26 ++++++++++++++------------ | ||
19 | 1 file changed, 14 insertions(+), 12 deletions(-) | ||
20 | |||
21 | diff --git a/block/qapi.c b/block/qapi.c | ||
22 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/block/qapi.c | 18 | --- a/contrib/vhost-user-scsi/vhost-user-scsi.c |
24 | +++ b/block/qapi.c | 19 | +++ b/contrib/vhost-user-scsi/vhost-user-scsi.c |
25 | @@ -XXX,XX +XXX,XX @@ static void bdrv_query_info(BlockBackend *blk, BlockInfo **p_info, | 20 | @@ -XXX,XX +XXX,XX @@ fail: |
26 | qapi_free_BlockInfo(info); | 21 | |
27 | } | 22 | /** vhost-user-scsi **/ |
28 | 23 | ||
29 | -static BlockStats *bdrv_query_stats(BlockBackend *blk, | 24 | +static int opt_fdnum = -1; |
30 | - const BlockDriverState *bs, | 25 | +static char *opt_socket_path; |
31 | - bool query_backing); | 26 | +static gboolean opt_print_caps; |
32 | - | 27 | +static char *iscsi_uri; |
33 | static void bdrv_query_blk_stats(BlockDeviceStats *ds, BlockBackend *blk) | 28 | + |
29 | +static GOptionEntry entries[] = { | ||
30 | + { "print-capabilities", 'c', 0, G_OPTION_ARG_NONE, &opt_print_caps, | ||
31 | + "Print capabilities", NULL }, | ||
32 | + { "fd", 'f', 0, G_OPTION_ARG_INT, &opt_fdnum, | ||
33 | + "Use inherited fd socket", "FDNUM" }, | ||
34 | + { "iscsi-uri", 'i', 0, G_OPTION_ARG_FILENAME, &iscsi_uri, | ||
35 | + "iSCSI URI to connect to", "FDNUM" }, | ||
36 | + { "socket-path", 's', 0, G_OPTION_ARG_FILENAME, &opt_socket_path, | ||
37 | + "Use UNIX socket path", "PATH" }, | ||
38 | + { NULL, } | ||
39 | +}; | ||
40 | + | ||
41 | int main(int argc, char **argv) | ||
34 | { | 42 | { |
35 | BlockAcctStats *stats = blk_get_stats(blk); | 43 | VusDev *vdev_scsi = NULL; |
36 | @@ -XXX,XX +XXX,XX @@ static void bdrv_query_blk_stats(BlockDeviceStats *ds, BlockBackend *blk) | 44 | - char *unix_fn = NULL; |
37 | } | 45 | - char *iscsi_uri = NULL; |
38 | } | 46 | - int lsock = -1, csock = -1, opt, err = EXIT_SUCCESS; |
39 | 47 | + int lsock = -1, csock = -1, err = EXIT_SUCCESS; | |
40 | -static void bdrv_query_bds_stats(BlockStats *s, const BlockDriverState *bs, | 48 | |
41 | +static BlockStats *bdrv_query_bds_stats(const BlockDriverState *bs, | 49 | - while ((opt = getopt(argc, argv, "u:i:")) != -1) { |
42 | bool query_backing) | 50 | - switch (opt) { |
43 | { | 51 | - case 'h': |
44 | + BlockStats *s = NULL; | 52 | - goto help; |
53 | - case 'u': | ||
54 | - unix_fn = g_strdup(optarg); | ||
55 | - break; | ||
56 | - case 'i': | ||
57 | - iscsi_uri = g_strdup(optarg); | ||
58 | - break; | ||
59 | - default: | ||
60 | - goto help; | ||
61 | - } | ||
62 | + GError *error = NULL; | ||
63 | + GOptionContext *context; | ||
45 | + | 64 | + |
46 | + s = g_malloc0(sizeof(*s)); | 65 | + context = g_option_context_new(NULL); |
47 | + s->stats = g_malloc0(sizeof(*s->stats)); | 66 | + g_option_context_add_main_entries(context, entries, NULL); |
48 | + | 67 | + if (!g_option_context_parse(context, &argc, &argv, &error)) { |
49 | + if (!bs) { | 68 | + g_printerr("Option parsing failed: %s\n", error->message); |
50 | + return s; | 69 | + exit(EXIT_FAILURE); |
51 | + } | 70 | + } |
52 | + | 71 | + |
53 | if (bdrv_get_node_name(bs)[0]) { | 72 | + if (opt_print_caps) { |
54 | s->has_node_name = true; | 73 | + g_print("{\n"); |
55 | s->node_name = g_strdup(bdrv_get_node_name(bs)); | 74 | + g_print(" \"type\": \"scsi\"\n"); |
56 | @@ -XXX,XX +XXX,XX @@ static void bdrv_query_bds_stats(BlockStats *s, const BlockDriverState *bs, | 75 | + g_print("}\n"); |
57 | 76 | + goto out; | |
58 | if (bs->file) { | ||
59 | s->has_parent = true; | ||
60 | - s->parent = bdrv_query_stats(NULL, bs->file->bs, query_backing); | ||
61 | + s->parent = bdrv_query_bds_stats(bs->file->bs, query_backing); | ||
62 | } | 77 | } |
63 | 78 | - if (!unix_fn || !iscsi_uri) { | |
64 | if (query_backing && bs->backing) { | 79 | + |
65 | s->has_backing = true; | 80 | + if (!iscsi_uri) { |
66 | - s->backing = bdrv_query_stats(NULL, bs->backing->bs, query_backing); | 81 | goto help; |
67 | + s->backing = bdrv_query_bds_stats(bs->backing->bs, query_backing); | ||
68 | } | 82 | } |
69 | 83 | ||
70 | + return s; | 84 | - lsock = unix_sock_new(unix_fn); |
71 | } | 85 | - if (lsock < 0) { |
72 | 86 | - goto err; | |
73 | static BlockStats *bdrv_query_stats(BlockBackend *blk, | 87 | + if (opt_socket_path) { |
74 | @@ -XXX,XX +XXX,XX @@ static BlockStats *bdrv_query_stats(BlockBackend *blk, | 88 | + lsock = unix_sock_new(opt_socket_path); |
75 | { | 89 | + if (lsock < 0) { |
76 | BlockStats *s; | 90 | + exit(EXIT_FAILURE); |
77 | 91 | + } | |
78 | - s = g_malloc0(sizeof(*s)); | 92 | + } else if (opt_fdnum < 0) { |
79 | - s->stats = g_malloc0(sizeof(*s->stats)); | 93 | + g_print("%s\n", g_option_context_get_help(context, true, NULL)); |
80 | + s = bdrv_query_bds_stats(bs, query_backing); | 94 | + exit(EXIT_FAILURE); |
81 | 95 | + } else { | |
82 | if (blk) { | 96 | + lsock = opt_fdnum; |
83 | s->has_device = true; | ||
84 | s->device = g_strdup(blk_name(blk)); | ||
85 | bdrv_query_blk_stats(s->stats, blk); | ||
86 | } | 97 | } |
87 | - if (bs) { | 98 | |
88 | - bdrv_query_bds_stats(s, bs, query_backing); | 99 | csock = accept(lsock, NULL, NULL); |
89 | - } | 100 | @@ -XXX,XX +XXX,XX @@ out: |
90 | 101 | if (vdev_scsi) { | |
91 | return s; | 102 | g_main_loop_unref(vdev_scsi->loop); |
92 | } | 103 | g_free(vdev_scsi); |
104 | - unlink(unix_fn); | ||
105 | + unlink(opt_socket_path); | ||
106 | } | ||
107 | if (csock >= 0) { | ||
108 | close(csock); | ||
109 | @@ -XXX,XX +XXX,XX @@ out: | ||
110 | if (lsock >= 0) { | ||
111 | close(lsock); | ||
112 | } | ||
113 | - g_free(unix_fn); | ||
114 | + g_free(opt_socket_path); | ||
115 | g_free(iscsi_uri); | ||
116 | |||
117 | return err; | ||
118 | @@ -XXX,XX +XXX,XX @@ err: | ||
119 | goto out; | ||
120 | |||
121 | help: | ||
122 | - fprintf(stderr, "Usage: %s [ -u unix_sock_path -i iscsi_uri ] | [ -h ]\n", | ||
123 | + fprintf(stderr, "Usage: %s [ -s socket-path -i iscsi-uri -f fd -p print-capabilities ] | [ -h ]\n", | ||
124 | argv[0]); | ||
125 | - fprintf(stderr, " -u path to unix socket\n"); | ||
126 | - fprintf(stderr, " -i iscsi uri for lun 0\n"); | ||
127 | + fprintf(stderr, " -s, --socket-path=SOCKET_PATH path to unix socket\n"); | ||
128 | + fprintf(stderr, " -i, --iscsi-uri=ISCSI_URI iscsi uri for lun 0\n"); | ||
129 | + fprintf(stderr, " -f, --fd=FILE_DESCRIPTOR file-descriptor\n"); | ||
130 | + fprintf(stderr, " -p, --print-capabilities=PRINT_CAPABILITIES denotes print-capabilities\n"); | ||
131 | fprintf(stderr, " -h print help and quit\n"); | ||
132 | |||
133 | goto err; | ||
93 | -- | 134 | -- |
94 | 2.11.0 | 135 | 2.35.1 |
95 | |||
96 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Dou Liyang <douly.fnst@cn.fujitsu.com> | ||
2 | 1 | ||
3 | In order to reduce the execution time, this patch optimize | ||
4 | the qmp_query_blockstats(): | ||
5 | Remove the next_query_bds function. | ||
6 | Remove the bdrv_query_stats function. | ||
7 | Remove some judgement sentence. | ||
8 | |||
9 | The original qmp_query_blockstats calls next_query_bds to get | ||
10 | the next objects in each loops. In the next_query_bds, it checks | ||
11 | the query_nodes and blk. It also call bdrv_query_stats to get | ||
12 | the stats, In the bdrv_query_stats, it checks blk and bs each | ||
13 | times. This waste more times, which may stall the main loop a | ||
14 | bit. And if the disk is too many and donot use the dataplane | ||
15 | feature, this may affect the performance in main loop thread. | ||
16 | |||
17 | This patch removes that two functions, and makes the structure | ||
18 | clearly. | ||
19 | |||
20 | Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com> | ||
21 | Message-id: 1484467275-27919-3-git-send-email-douly.fnst@cn.fujitsu.com | ||
22 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | ||
23 | [mreitz: Removed duplicate info->value assignment] | ||
24 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
25 | --- | ||
26 | block/qapi.c | 73 ++++++++++++++++++++++++------------------------------------ | ||
27 | 1 file changed, 29 insertions(+), 44 deletions(-) | ||
28 | |||
29 | diff --git a/block/qapi.c b/block/qapi.c | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/block/qapi.c | ||
32 | +++ b/block/qapi.c | ||
33 | @@ -XXX,XX +XXX,XX @@ static BlockStats *bdrv_query_bds_stats(const BlockDriverState *bs, | ||
34 | return s; | ||
35 | } | ||
36 | |||
37 | -static BlockStats *bdrv_query_stats(BlockBackend *blk, | ||
38 | - const BlockDriverState *bs, | ||
39 | - bool query_backing) | ||
40 | -{ | ||
41 | - BlockStats *s; | ||
42 | - | ||
43 | - s = bdrv_query_bds_stats(bs, query_backing); | ||
44 | - | ||
45 | - if (blk) { | ||
46 | - s->has_device = true; | ||
47 | - s->device = g_strdup(blk_name(blk)); | ||
48 | - bdrv_query_blk_stats(s->stats, blk); | ||
49 | - } | ||
50 | - | ||
51 | - return s; | ||
52 | -} | ||
53 | - | ||
54 | BlockInfoList *qmp_query_block(Error **errp) | ||
55 | { | ||
56 | BlockInfoList *head = NULL, **p_next = &head; | ||
57 | @@ -XXX,XX +XXX,XX @@ BlockInfoList *qmp_query_block(Error **errp) | ||
58 | return head; | ||
59 | } | ||
60 | |||
61 | -static bool next_query_bds(BlockBackend **blk, BlockDriverState **bs, | ||
62 | - bool query_nodes) | ||
63 | -{ | ||
64 | - if (query_nodes) { | ||
65 | - *bs = bdrv_next_node(*bs); | ||
66 | - return !!*bs; | ||
67 | - } | ||
68 | - | ||
69 | - *blk = blk_next(*blk); | ||
70 | - *bs = *blk ? blk_bs(*blk) : NULL; | ||
71 | - | ||
72 | - return !!*blk; | ||
73 | -} | ||
74 | - | ||
75 | BlockStatsList *qmp_query_blockstats(bool has_query_nodes, | ||
76 | bool query_nodes, | ||
77 | Error **errp) | ||
78 | { | ||
79 | BlockStatsList *head = NULL, **p_next = &head; | ||
80 | - BlockBackend *blk = NULL; | ||
81 | - BlockDriverState *bs = NULL; | ||
82 | + BlockBackend *blk; | ||
83 | + BlockDriverState *bs; | ||
84 | |||
85 | /* Just to be safe if query_nodes is not always initialized */ | ||
86 | - query_nodes = has_query_nodes && query_nodes; | ||
87 | - | ||
88 | - while (next_query_bds(&blk, &bs, query_nodes)) { | ||
89 | - BlockStatsList *info = g_malloc0(sizeof(*info)); | ||
90 | - AioContext *ctx = blk ? blk_get_aio_context(blk) | ||
91 | - : bdrv_get_aio_context(bs); | ||
92 | + if (has_query_nodes && query_nodes) { | ||
93 | + for (bs = bdrv_next_node(NULL); bs; bs = bdrv_next_node(bs)) { | ||
94 | + BlockStatsList *info = g_malloc0(sizeof(*info)); | ||
95 | + AioContext *ctx = bdrv_get_aio_context(bs); | ||
96 | |||
97 | - aio_context_acquire(ctx); | ||
98 | - info->value = bdrv_query_stats(blk, bs, !query_nodes); | ||
99 | - aio_context_release(ctx); | ||
100 | + aio_context_acquire(ctx); | ||
101 | + info->value = bdrv_query_bds_stats(bs, false); | ||
102 | + aio_context_release(ctx); | ||
103 | |||
104 | - *p_next = info; | ||
105 | - p_next = &info->next; | ||
106 | + *p_next = info; | ||
107 | + p_next = &info->next; | ||
108 | + } | ||
109 | + } else { | ||
110 | + for (blk = blk_next(NULL); blk; blk = blk_next(blk)) { | ||
111 | + BlockStatsList *info = g_malloc0(sizeof(*info)); | ||
112 | + AioContext *ctx = blk_get_aio_context(blk); | ||
113 | + BlockStats *s; | ||
114 | + | ||
115 | + aio_context_acquire(ctx); | ||
116 | + s = bdrv_query_bds_stats(blk_bs(blk), true); | ||
117 | + s->has_device = true; | ||
118 | + s->device = g_strdup(blk_name(blk)); | ||
119 | + bdrv_query_blk_stats(s->stats, blk); | ||
120 | + aio_context_release(ctx); | ||
121 | + | ||
122 | + info->value = s; | ||
123 | + *p_next = info; | ||
124 | + p_next = &info->next; | ||
125 | + } | ||
126 | } | ||
127 | |||
128 | return head; | ||
129 | -- | ||
130 | 2.11.0 | ||
131 | |||
132 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
2 | 1 | ||
3 | Current implementation invalidates firstly parent bds and then its | ||
4 | children. This leads to the following bug: | ||
5 | |||
6 | after incoming migration, in bdrv_invalidate_cache_all: | ||
7 | 1. invalidate parent bds - reopen it with BDRV_O_INACTIVE cleared | ||
8 | 2. child is not yet invalidated | ||
9 | 3. parent check that its BDRV_O_INACTIVE is cleared | ||
10 | 4. parent writes to child | ||
11 | 5. assert in bdrv_co_pwritev, as BDRV_O_INACTIVE is set for child | ||
12 | |||
13 | This patch fixes it by just changing invalidate sequence: invalidate | ||
14 | children first. | ||
15 | |||
16 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
17 | Message-id: 20170131112308.54189-1-vsementsov@virtuozzo.com | ||
18 | Reviewed-by: Max Reitz <mreitz@redhat.com> | ||
19 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
20 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
21 | --- | ||
22 | block.c | 11 +++++------ | ||
23 | 1 file changed, 5 insertions(+), 6 deletions(-) | ||
24 | |||
25 | diff --git a/block.c b/block.c | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/block.c | ||
28 | +++ b/block.c | ||
29 | @@ -XXX,XX +XXX,XX @@ void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp) | ||
30 | if (!(bs->open_flags & BDRV_O_INACTIVE)) { | ||
31 | return; | ||
32 | } | ||
33 | - bs->open_flags &= ~BDRV_O_INACTIVE; | ||
34 | |||
35 | - if (bs->drv->bdrv_invalidate_cache) { | ||
36 | - bs->drv->bdrv_invalidate_cache(bs, &local_err); | ||
37 | + QLIST_FOREACH(child, &bs->children, next) { | ||
38 | + bdrv_invalidate_cache(child->bs, &local_err); | ||
39 | if (local_err) { | ||
40 | - bs->open_flags |= BDRV_O_INACTIVE; | ||
41 | error_propagate(errp, local_err); | ||
42 | return; | ||
43 | } | ||
44 | } | ||
45 | |||
46 | - QLIST_FOREACH(child, &bs->children, next) { | ||
47 | - bdrv_invalidate_cache(child->bs, &local_err); | ||
48 | + bs->open_flags &= ~BDRV_O_INACTIVE; | ||
49 | + if (bs->drv->bdrv_invalidate_cache) { | ||
50 | + bs->drv->bdrv_invalidate_cache(bs, &local_err); | ||
51 | if (local_err) { | ||
52 | bs->open_flags |= BDRV_O_INACTIVE; | ||
53 | error_propagate(errp, local_err); | ||
54 | -- | ||
55 | 2.11.0 | ||
56 | |||
57 | diff view generated by jsdifflib |
1 | From: Peter Lieven <pl@kamp.de> | 1 | The GLib documentation says "a NULL-terminated array of GOptionEntrys" |
---|---|---|---|
2 | so we'd better make sure there is a terminator that lets | ||
3 | g_option_context_add_main_entries() know when the end of the array has | ||
4 | been reached. | ||
2 | 5 | ||
3 | parse_uint_full wants to put the parsed value into the | 6 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
4 | variable passed via its second argument which is NULL. | 7 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> |
5 | 8 | Message-id: 20220411150057.3009667-1-stefanha@redhat.com | |
6 | Fixes: 94d6a7a76e9df9919629428f6c598e2b97d9426c | 9 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
7 | Cc: qemu-stable@nongnu.org | ||
8 | Signed-off-by: Peter Lieven <pl@kamp.de> | ||
9 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
10 | Message-id: 1485942829-10756-2-git-send-email-pl@kamp.de | ||
11 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
12 | --- | 10 | --- |
13 | block/nfs.c | 3 ++- | 11 | contrib/vhost-user-blk/vhost-user-blk.c | 3 ++- |
14 | 1 file changed, 2 insertions(+), 1 deletion(-) | 12 | 1 file changed, 2 insertions(+), 1 deletion(-) |
15 | 13 | ||
16 | diff --git a/block/nfs.c b/block/nfs.c | 14 | diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c |
17 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/block/nfs.c | 16 | --- a/contrib/vhost-user-blk/vhost-user-blk.c |
19 | +++ b/block/nfs.c | 17 | +++ b/contrib/vhost-user-blk/vhost-user-blk.c |
20 | @@ -XXX,XX +XXX,XX @@ static int nfs_parse_uri(const char *filename, QDict *options, Error **errp) | 18 | @@ -XXX,XX +XXX,XX @@ static GOptionEntry entries[] = { |
21 | qdict_put(options, "path", qstring_from_str(uri->path)); | 19 | {"blk-file", 'b', 0, G_OPTION_ARG_FILENAME, &opt_blk_file, |
22 | 20 | "block device or file path", "PATH"}, | |
23 | for (i = 0; i < qp->n; i++) { | 21 | { "read-only", 'r', 0, G_OPTION_ARG_NONE, &opt_read_only, |
24 | + unsigned long long val; | 22 | - "Enable read-only", NULL } |
25 | if (!qp->p[i].value) { | 23 | + "Enable read-only", NULL }, |
26 | error_setg(errp, "Value for NFS parameter expected: %s", | 24 | + { NULL, }, |
27 | qp->p[i].name); | 25 | }; |
28 | goto out; | 26 | |
29 | } | 27 | int main(int argc, char **argv) |
30 | - if (parse_uint_full(qp->p[i].value, NULL, 0)) { | ||
31 | + if (parse_uint_full(qp->p[i].value, &val, 0)) { | ||
32 | error_setg(errp, "Illegal value for NFS parameter: %s", | ||
33 | qp->p[i].name); | ||
34 | goto out; | ||
35 | -- | 28 | -- |
36 | 2.11.0 | 29 | 2.35.1 |
37 | |||
38 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Peter Lieven <pl@kamp.de> | ||
2 | 1 | ||
3 | commit 94d6a7a accidentally left the naming of runtime opts and QAPI | ||
4 | scheme inconsistent. As one consequence passing of parameters in the | ||
5 | URI is broken. Sync the naming of the runtime opts to the QAPI | ||
6 | scheme. | ||
7 | |||
8 | Please note that this is technically backwards incompatible with the 2.8 | ||
9 | release, but the 2.8 release is the only version that had the wrong naming. | ||
10 | Furthermore release 2.8 suffered from a NULL pointer dereference during | ||
11 | URI parsing. | ||
12 | |||
13 | Fixes: 94d6a7a76e9df9919629428f6c598e2b97d9426c | ||
14 | Cc: qemu-stable@nongnu.org | ||
15 | Signed-off-by: Peter Lieven <pl@kamp.de> | ||
16 | Message-id: 1485942829-10756-3-git-send-email-pl@kamp.de | ||
17 | [mreitz: Fixed commit message] | ||
18 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
19 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
20 | --- | ||
21 | block/nfs.c | 46 +++++++++++++++++++++++----------------------- | ||
22 | 1 file changed, 23 insertions(+), 23 deletions(-) | ||
23 | |||
24 | diff --git a/block/nfs.c b/block/nfs.c | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/block/nfs.c | ||
27 | +++ b/block/nfs.c | ||
28 | @@ -XXX,XX +XXX,XX @@ static QemuOptsList runtime_opts = { | ||
29 | .help = "Path of the image on the host", | ||
30 | }, | ||
31 | { | ||
32 | - .name = "uid", | ||
33 | + .name = "user", | ||
34 | .type = QEMU_OPT_NUMBER, | ||
35 | .help = "UID value to use when talking to the server", | ||
36 | }, | ||
37 | { | ||
38 | - .name = "gid", | ||
39 | + .name = "group", | ||
40 | .type = QEMU_OPT_NUMBER, | ||
41 | .help = "GID value to use when talking to the server", | ||
42 | }, | ||
43 | { | ||
44 | - .name = "tcp-syncnt", | ||
45 | + .name = "tcp-syn-count", | ||
46 | .type = QEMU_OPT_NUMBER, | ||
47 | .help = "Number of SYNs to send during the session establish", | ||
48 | }, | ||
49 | { | ||
50 | - .name = "readahead", | ||
51 | + .name = "readahead-size", | ||
52 | .type = QEMU_OPT_NUMBER, | ||
53 | .help = "Set the readahead size in bytes", | ||
54 | }, | ||
55 | { | ||
56 | - .name = "pagecache", | ||
57 | + .name = "page-cache-size", | ||
58 | .type = QEMU_OPT_NUMBER, | ||
59 | .help = "Set the pagecache size in bytes", | ||
60 | }, | ||
61 | @@ -XXX,XX +XXX,XX @@ static int64_t nfs_client_open(NFSClient *client, QDict *options, | ||
62 | goto fail; | ||
63 | } | ||
64 | |||
65 | - if (qemu_opt_get(opts, "uid")) { | ||
66 | - client->uid = qemu_opt_get_number(opts, "uid", 0); | ||
67 | + if (qemu_opt_get(opts, "user")) { | ||
68 | + client->uid = qemu_opt_get_number(opts, "user", 0); | ||
69 | nfs_set_uid(client->context, client->uid); | ||
70 | } | ||
71 | |||
72 | - if (qemu_opt_get(opts, "gid")) { | ||
73 | - client->gid = qemu_opt_get_number(opts, "gid", 0); | ||
74 | + if (qemu_opt_get(opts, "group")) { | ||
75 | + client->gid = qemu_opt_get_number(opts, "group", 0); | ||
76 | nfs_set_gid(client->context, client->gid); | ||
77 | } | ||
78 | |||
79 | - if (qemu_opt_get(opts, "tcp-syncnt")) { | ||
80 | - client->tcp_syncnt = qemu_opt_get_number(opts, "tcp-syncnt", 0); | ||
81 | + if (qemu_opt_get(opts, "tcp-syn-count")) { | ||
82 | + client->tcp_syncnt = qemu_opt_get_number(opts, "tcp-syn-count", 0); | ||
83 | nfs_set_tcp_syncnt(client->context, client->tcp_syncnt); | ||
84 | } | ||
85 | |||
86 | #ifdef LIBNFS_FEATURE_READAHEAD | ||
87 | - if (qemu_opt_get(opts, "readahead")) { | ||
88 | + if (qemu_opt_get(opts, "readahead-size")) { | ||
89 | if (open_flags & BDRV_O_NOCACHE) { | ||
90 | error_setg(errp, "Cannot enable NFS readahead " | ||
91 | "if cache.direct = on"); | ||
92 | goto fail; | ||
93 | } | ||
94 | - client->readahead = qemu_opt_get_number(opts, "readahead", 0); | ||
95 | + client->readahead = qemu_opt_get_number(opts, "readahead-size", 0); | ||
96 | if (client->readahead > QEMU_NFS_MAX_READAHEAD_SIZE) { | ||
97 | error_report("NFS Warning: Truncating NFS readahead " | ||
98 | "size to %d", QEMU_NFS_MAX_READAHEAD_SIZE); | ||
99 | @@ -XXX,XX +XXX,XX @@ static int64_t nfs_client_open(NFSClient *client, QDict *options, | ||
100 | #endif | ||
101 | |||
102 | #ifdef LIBNFS_FEATURE_PAGECACHE | ||
103 | - if (qemu_opt_get(opts, "pagecache")) { | ||
104 | + if (qemu_opt_get(opts, "page-cache-size")) { | ||
105 | if (open_flags & BDRV_O_NOCACHE) { | ||
106 | error_setg(errp, "Cannot enable NFS pagecache " | ||
107 | "if cache.direct = on"); | ||
108 | goto fail; | ||
109 | } | ||
110 | - client->pagecache = qemu_opt_get_number(opts, "pagecache", 0); | ||
111 | + client->pagecache = qemu_opt_get_number(opts, "page-cache-size", 0); | ||
112 | if (client->pagecache > QEMU_NFS_MAX_PAGECACHE_SIZE) { | ||
113 | error_report("NFS Warning: Truncating NFS pagecache " | ||
114 | "size to %d pages", QEMU_NFS_MAX_PAGECACHE_SIZE); | ||
115 | @@ -XXX,XX +XXX,XX @@ static void nfs_refresh_filename(BlockDriverState *bs, QDict *options) | ||
116 | qdict_put(opts, "path", qstring_from_str(client->path)); | ||
117 | |||
118 | if (client->uid) { | ||
119 | - qdict_put(opts, "uid", qint_from_int(client->uid)); | ||
120 | + qdict_put(opts, "user", qint_from_int(client->uid)); | ||
121 | } | ||
122 | if (client->gid) { | ||
123 | - qdict_put(opts, "gid", qint_from_int(client->gid)); | ||
124 | + qdict_put(opts, "group", qint_from_int(client->gid)); | ||
125 | } | ||
126 | if (client->tcp_syncnt) { | ||
127 | - qdict_put(opts, "tcp-syncnt", | ||
128 | - qint_from_int(client->tcp_syncnt)); | ||
129 | + qdict_put(opts, "tcp-syn-cnt", | ||
130 | + qint_from_int(client->tcp_syncnt)); | ||
131 | } | ||
132 | if (client->readahead) { | ||
133 | - qdict_put(opts, "readahead", | ||
134 | - qint_from_int(client->readahead)); | ||
135 | + qdict_put(opts, "readahead-size", | ||
136 | + qint_from_int(client->readahead)); | ||
137 | } | ||
138 | if (client->pagecache) { | ||
139 | - qdict_put(opts, "pagecache", | ||
140 | - qint_from_int(client->pagecache)); | ||
141 | + qdict_put(opts, "page-cache-size", | ||
142 | + qint_from_int(client->pagecache)); | ||
143 | } | ||
144 | if (client->debug) { | ||
145 | qdict_put(opts, "debug", qint_from_int(client->debug)); | ||
146 | -- | ||
147 | 2.11.0 | ||
148 | |||
149 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Nir Soffer <nirsof@gmail.com> | ||
2 | 1 | ||
3 | The result of openfile was not checked, leading to failure deep in the | ||
4 | actual command with confusing error message, and exiting with exit code 0. | ||
5 | |||
6 | Here is a simple example - trying to read with the wrong format: | ||
7 | |||
8 | $ touch file | ||
9 | $ qemu-io -f qcow2 -c 'read -P 1 0 1024' file; echo $? | ||
10 | can't open device file: Image is not in qcow2 format | ||
11 | no file open, try 'help open' | ||
12 | 0 | ||
13 | |||
14 | With this patch, we fail earlier with exit code 1: | ||
15 | |||
16 | $ ./qemu-io -f qcow2 -c 'read -P 1 0 1024' file; echo $? | ||
17 | can't open device file: Image is not in qcow2 format | ||
18 | 1 | ||
19 | |||
20 | Failing earlier, we don't log this error now: | ||
21 | |||
22 | no file open, try 'help open' | ||
23 | |||
24 | But some tests expected it; the line was removed from the test output. | ||
25 | |||
26 | Signed-off-by: Nir Soffer <nirsof@gmail.com> | ||
27 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
28 | Message-id: 20170201003120.23378-2-nirsof@gmail.com | ||
29 | Reviewed-by: Max Reitz <mreitz@redhat.com> | ||
30 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
31 | --- | ||
32 | qemu-io.c | 8 ++++++-- | ||
33 | tests/qemu-iotests/059.out | 3 --- | ||
34 | tests/qemu-iotests/070.out | 1 - | ||
35 | tests/qemu-iotests/075.out | 7 ------- | ||
36 | tests/qemu-iotests/076.out | 3 --- | ||
37 | tests/qemu-iotests/078.out | 6 ------ | ||
38 | tests/qemu-iotests/080.out | 18 ------------------ | ||
39 | tests/qemu-iotests/083.out | 17 ----------------- | ||
40 | tests/qemu-iotests/088.out | 6 ------ | ||
41 | tests/qemu-iotests/092.out | 12 ------------ | ||
42 | tests/qemu-iotests/116.out | 7 ------- | ||
43 | tests/qemu-iotests/131.out | 1 - | ||
44 | tests/qemu-iotests/140.out | 1 - | ||
45 | 13 files changed, 6 insertions(+), 84 deletions(-) | ||
46 | |||
47 | diff --git a/qemu-io.c b/qemu-io.c | ||
48 | index XXXXXXX..XXXXXXX 100644 | ||
49 | --- a/qemu-io.c | ||
50 | +++ b/qemu-io.c | ||
51 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv) | ||
52 | exit(1); | ||
53 | } | ||
54 | opts = qemu_opts_to_qdict(qopts, NULL); | ||
55 | - openfile(NULL, flags, writethrough, opts); | ||
56 | + if (openfile(NULL, flags, writethrough, opts)) { | ||
57 | + exit(1); | ||
58 | + } | ||
59 | } else { | ||
60 | if (format) { | ||
61 | opts = qdict_new(); | ||
62 | qdict_put(opts, "driver", qstring_from_str(format)); | ||
63 | } | ||
64 | - openfile(argv[optind], flags, writethrough, opts); | ||
65 | + if (openfile(argv[optind], flags, writethrough, opts)) { | ||
66 | + exit(1); | ||
67 | + } | ||
68 | } | ||
69 | } | ||
70 | command_loop(); | ||
71 | diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out | ||
72 | index XXXXXXX..XXXXXXX 100644 | ||
73 | --- a/tests/qemu-iotests/059.out | ||
74 | +++ b/tests/qemu-iotests/059.out | ||
75 | @@ -XXX,XX +XXX,XX @@ QA output created by 059 | ||
76 | === Testing invalid granularity === | ||
77 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
78 | can't open device TEST_DIR/t.vmdk: Invalid granularity, image may be corrupt | ||
79 | -no file open, try 'help open' | ||
80 | |||
81 | === Testing too big L2 table size === | ||
82 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
83 | can't open device TEST_DIR/t.vmdk: L2 table size too big | ||
84 | -no file open, try 'help open' | ||
85 | |||
86 | === Testing too big L1 table size === | ||
87 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
88 | can't open device TEST_DIR/t.vmdk: L1 size too big | ||
89 | -no file open, try 'help open' | ||
90 | |||
91 | === Testing monolithicFlat creation and opening === | ||
92 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 subformat=monolithicFlat | ||
93 | diff --git a/tests/qemu-iotests/070.out b/tests/qemu-iotests/070.out | ||
94 | index XXXXXXX..XXXXXXX 100644 | ||
95 | --- a/tests/qemu-iotests/070.out | ||
96 | +++ b/tests/qemu-iotests/070.out | ||
97 | @@ -XXX,XX +XXX,XX @@ QA output created by 070 | ||
98 | can't open device TEST_DIR/iotest-dirtylog-10G-4M.vhdx: VHDX image file 'TEST_DIR/iotest-dirtylog-10G-4M.vhdx' opened read-only, but contains a log that needs to be replayed | ||
99 | To replay the log, run: | ||
100 | qemu-img check -r all 'TEST_DIR/iotest-dirtylog-10G-4M.vhdx' | ||
101 | - no file open, try 'help open' | ||
102 | === Verify open image replays log === | ||
103 | read 18874368/18874368 bytes at offset 0 | ||
104 | 18 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
105 | diff --git a/tests/qemu-iotests/075.out b/tests/qemu-iotests/075.out | ||
106 | index XXXXXXX..XXXXXXX 100644 | ||
107 | --- a/tests/qemu-iotests/075.out | ||
108 | +++ b/tests/qemu-iotests/075.out | ||
109 | @@ -XXX,XX +XXX,XX @@ read 512/512 bytes at offset 1048064 | ||
110 | |||
111 | == block_size must be a multiple of 512 == | ||
112 | can't open device TEST_DIR/simple-pattern.cloop: block_size 513 must be a multiple of 512 | ||
113 | -no file open, try 'help open' | ||
114 | |||
115 | == block_size cannot be zero == | ||
116 | can't open device TEST_DIR/simple-pattern.cloop: block_size cannot be zero | ||
117 | -no file open, try 'help open' | ||
118 | |||
119 | == huge block_size === | ||
120 | can't open device TEST_DIR/simple-pattern.cloop: block_size 4294966784 must be 64 MB or less | ||
121 | -no file open, try 'help open' | ||
122 | |||
123 | == offsets_size overflow === | ||
124 | can't open device TEST_DIR/simple-pattern.cloop: n_blocks 4294967295 must be 536870911 or less | ||
125 | -no file open, try 'help open' | ||
126 | |||
127 | == refuse images that require too many offsets === | ||
128 | can't open device TEST_DIR/simple-pattern.cloop: image requires too many offsets, try increasing block size | ||
129 | -no file open, try 'help open' | ||
130 | |||
131 | == refuse images with non-monotonically increasing offsets == | ||
132 | can't open device TEST_DIR/simple-pattern.cloop: offsets not monotonically increasing at index 1, image file is corrupt | ||
133 | -no file open, try 'help open' | ||
134 | |||
135 | == refuse images with invalid compressed block size == | ||
136 | can't open device TEST_DIR/simple-pattern.cloop: invalid compressed block size at index 1, image file is corrupt | ||
137 | -no file open, try 'help open' | ||
138 | *** done | ||
139 | diff --git a/tests/qemu-iotests/076.out b/tests/qemu-iotests/076.out | ||
140 | index XXXXXXX..XXXXXXX 100644 | ||
141 | --- a/tests/qemu-iotests/076.out | ||
142 | +++ b/tests/qemu-iotests/076.out | ||
143 | @@ -XXX,XX +XXX,XX @@ read 65536/65536 bytes at offset 0 | ||
144 | |||
145 | == Negative catalog size == | ||
146 | can't open device TEST_DIR/parallels-v1: Catalog too large | ||
147 | -no file open, try 'help open' | ||
148 | |||
149 | == Overflow in catalog allocation == | ||
150 | can't open device TEST_DIR/parallels-v1: Catalog too large | ||
151 | -no file open, try 'help open' | ||
152 | |||
153 | == Zero sectors per track == | ||
154 | can't open device TEST_DIR/parallels-v1: Invalid image: Zero sectors per track | ||
155 | -no file open, try 'help open' | ||
156 | |||
157 | == Read from a valid v2 image == | ||
158 | read 65536/65536 bytes at offset 0 | ||
159 | diff --git a/tests/qemu-iotests/078.out b/tests/qemu-iotests/078.out | ||
160 | index XXXXXXX..XXXXXXX 100644 | ||
161 | --- a/tests/qemu-iotests/078.out | ||
162 | +++ b/tests/qemu-iotests/078.out | ||
163 | @@ -XXX,XX +XXX,XX @@ read 512/512 bytes at offset 0 | ||
164 | |||
165 | == Negative catalog size == | ||
166 | can't open device TEST_DIR/empty.bochs: Catalog size is too large | ||
167 | -no file open, try 'help open' | ||
168 | |||
169 | == Overflow for catalog size * sizeof(uint32_t) == | ||
170 | can't open device TEST_DIR/empty.bochs: Catalog size is too large | ||
171 | -no file open, try 'help open' | ||
172 | |||
173 | == Too small catalog bitmap for image size == | ||
174 | can't open device TEST_DIR/empty.bochs: Catalog size is too small for this disk size | ||
175 | -no file open, try 'help open' | ||
176 | can't open device TEST_DIR/empty.bochs: Catalog size is too small for this disk size | ||
177 | -no file open, try 'help open' | ||
178 | |||
179 | == Negative extent size == | ||
180 | can't open device TEST_DIR/empty.bochs: Extent size 2147483648 is too large | ||
181 | -no file open, try 'help open' | ||
182 | |||
183 | == Zero extent size == | ||
184 | can't open device TEST_DIR/empty.bochs: Extent size must be at least 512 | ||
185 | -no file open, try 'help open' | ||
186 | *** done | ||
187 | diff --git a/tests/qemu-iotests/080.out b/tests/qemu-iotests/080.out | ||
188 | index XXXXXXX..XXXXXXX 100644 | ||
189 | --- a/tests/qemu-iotests/080.out | ||
190 | +++ b/tests/qemu-iotests/080.out | ||
191 | @@ -XXX,XX +XXX,XX @@ QA output created by 080 | ||
192 | == Huge header size == | ||
193 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
194 | can't open device TEST_DIR/t.qcow2: qcow2 header exceeds cluster size | ||
195 | -no file open, try 'help open' | ||
196 | can't open device TEST_DIR/t.qcow2: qcow2 header exceeds cluster size | ||
197 | -no file open, try 'help open' | ||
198 | |||
199 | == Huge unknown header extension == | ||
200 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
201 | can't open device TEST_DIR/t.qcow2: Invalid backing file offset | ||
202 | -no file open, try 'help open' | ||
203 | can't open device TEST_DIR/t.qcow2: Header extension too large | ||
204 | -no file open, try 'help open' | ||
205 | can't open device TEST_DIR/t.qcow2: Header extension too large | ||
206 | -no file open, try 'help open' | ||
207 | |||
208 | == Huge refcount table size == | ||
209 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
210 | can't open device TEST_DIR/t.qcow2: Reference count table too large | ||
211 | -no file open, try 'help open' | ||
212 | can't open device TEST_DIR/t.qcow2: Reference count table too large | ||
213 | -no file open, try 'help open' | ||
214 | |||
215 | == Misaligned refcount table == | ||
216 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
217 | can't open device TEST_DIR/t.qcow2: Invalid reference count table offset | ||
218 | -no file open, try 'help open' | ||
219 | |||
220 | == Huge refcount offset == | ||
221 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
222 | can't open device TEST_DIR/t.qcow2: Invalid reference count table offset | ||
223 | -no file open, try 'help open' | ||
224 | |||
225 | == Invalid snapshot table == | ||
226 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
227 | can't open device TEST_DIR/t.qcow2: Too many snapshots | ||
228 | -no file open, try 'help open' | ||
229 | can't open device TEST_DIR/t.qcow2: Too many snapshots | ||
230 | -no file open, try 'help open' | ||
231 | can't open device TEST_DIR/t.qcow2: Invalid snapshot table offset | ||
232 | -no file open, try 'help open' | ||
233 | can't open device TEST_DIR/t.qcow2: Invalid snapshot table offset | ||
234 | -no file open, try 'help open' | ||
235 | |||
236 | == Hitting snapshot table size limit == | ||
237 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
238 | @@ -XXX,XX +XXX,XX @@ read 512/512 bytes at offset 0 | ||
239 | == Invalid L1 table == | ||
240 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
241 | can't open device TEST_DIR/t.qcow2: Active L1 table too large | ||
242 | -no file open, try 'help open' | ||
243 | can't open device TEST_DIR/t.qcow2: Active L1 table too large | ||
244 | -no file open, try 'help open' | ||
245 | can't open device TEST_DIR/t.qcow2: Invalid L1 table offset | ||
246 | -no file open, try 'help open' | ||
247 | can't open device TEST_DIR/t.qcow2: Invalid L1 table offset | ||
248 | -no file open, try 'help open' | ||
249 | |||
250 | == Invalid L1 table (with internal snapshot in the image) == | ||
251 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
252 | @@ -XXX,XX +XXX,XX @@ qemu-img: Could not open 'TEST_DIR/t.IMGFMT': L1 table is too small | ||
253 | == Invalid backing file size == | ||
254 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
255 | can't open device TEST_DIR/t.qcow2: Backing file name too long | ||
256 | -no file open, try 'help open' | ||
257 | |||
258 | == Invalid L2 entry (huge physical offset) == | ||
259 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
260 | diff --git a/tests/qemu-iotests/083.out b/tests/qemu-iotests/083.out | ||
261 | index XXXXXXX..XXXXXXX 100644 | ||
262 | --- a/tests/qemu-iotests/083.out | ||
263 | +++ b/tests/qemu-iotests/083.out | ||
264 | @@ -XXX,XX +XXX,XX @@ QA output created by 083 | ||
265 | === Check disconnect before neg1 === | ||
266 | |||
267 | can't open device nbd:127.0.0.1:PORT:exportname=foo | ||
268 | -no file open, try 'help open' | ||
269 | |||
270 | === Check disconnect after neg1 === | ||
271 | |||
272 | can't open device nbd:127.0.0.1:PORT:exportname=foo | ||
273 | -no file open, try 'help open' | ||
274 | |||
275 | === Check disconnect 8 neg1 === | ||
276 | |||
277 | can't open device nbd:127.0.0.1:PORT:exportname=foo | ||
278 | -no file open, try 'help open' | ||
279 | |||
280 | === Check disconnect 16 neg1 === | ||
281 | |||
282 | can't open device nbd:127.0.0.1:PORT:exportname=foo | ||
283 | -no file open, try 'help open' | ||
284 | |||
285 | === Check disconnect before export === | ||
286 | |||
287 | can't open device nbd:127.0.0.1:PORT:exportname=foo | ||
288 | -no file open, try 'help open' | ||
289 | |||
290 | === Check disconnect after export === | ||
291 | |||
292 | can't open device nbd:127.0.0.1:PORT:exportname=foo | ||
293 | -no file open, try 'help open' | ||
294 | |||
295 | === Check disconnect 4 export === | ||
296 | |||
297 | can't open device nbd:127.0.0.1:PORT:exportname=foo | ||
298 | -no file open, try 'help open' | ||
299 | |||
300 | === Check disconnect 12 export === | ||
301 | |||
302 | can't open device nbd:127.0.0.1:PORT:exportname=foo | ||
303 | -no file open, try 'help open' | ||
304 | |||
305 | === Check disconnect 16 export === | ||
306 | |||
307 | can't open device nbd:127.0.0.1:PORT:exportname=foo | ||
308 | -no file open, try 'help open' | ||
309 | |||
310 | === Check disconnect before neg2 === | ||
311 | |||
312 | can't open device nbd:127.0.0.1:PORT:exportname=foo | ||
313 | -no file open, try 'help open' | ||
314 | |||
315 | === Check disconnect after neg2 === | ||
316 | |||
317 | @@ -XXX,XX +XXX,XX @@ read failed: Input/output error | ||
318 | === Check disconnect 8 neg2 === | ||
319 | |||
320 | can't open device nbd:127.0.0.1:PORT:exportname=foo | ||
321 | -no file open, try 'help open' | ||
322 | |||
323 | === Check disconnect 10 neg2 === | ||
324 | |||
325 | can't open device nbd:127.0.0.1:PORT:exportname=foo | ||
326 | -no file open, try 'help open' | ||
327 | |||
328 | === Check disconnect before request === | ||
329 | |||
330 | @@ -XXX,XX +XXX,XX @@ read 512/512 bytes at offset 0 | ||
331 | === Check disconnect before neg-classic === | ||
332 | |||
333 | can't open device nbd:127.0.0.1:PORT | ||
334 | -no file open, try 'help open' | ||
335 | |||
336 | === Check disconnect 8 neg-classic === | ||
337 | |||
338 | can't open device nbd:127.0.0.1:PORT | ||
339 | -no file open, try 'help open' | ||
340 | |||
341 | === Check disconnect 16 neg-classic === | ||
342 | |||
343 | can't open device nbd:127.0.0.1:PORT | ||
344 | -no file open, try 'help open' | ||
345 | |||
346 | === Check disconnect 24 neg-classic === | ||
347 | |||
348 | can't open device nbd:127.0.0.1:PORT | ||
349 | -no file open, try 'help open' | ||
350 | |||
351 | === Check disconnect 28 neg-classic === | ||
352 | |||
353 | can't open device nbd:127.0.0.1:PORT | ||
354 | -no file open, try 'help open' | ||
355 | |||
356 | === Check disconnect after neg-classic === | ||
357 | |||
358 | diff --git a/tests/qemu-iotests/088.out b/tests/qemu-iotests/088.out | ||
359 | index XXXXXXX..XXXXXXX 100644 | ||
360 | --- a/tests/qemu-iotests/088.out | ||
361 | +++ b/tests/qemu-iotests/088.out | ||
362 | @@ -XXX,XX +XXX,XX @@ QA output created by 088 | ||
363 | == Invalid block size == | ||
364 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
365 | can't open device TEST_DIR/t.vpc: Invalid block size 0 | ||
366 | -no file open, try 'help open' | ||
367 | can't open device TEST_DIR/t.vpc: Invalid block size 0 | ||
368 | -no file open, try 'help open' | ||
369 | can't open device TEST_DIR/t.vpc: Invalid block size 128 | ||
370 | -no file open, try 'help open' | ||
371 | can't open device TEST_DIR/t.vpc: Invalid block size 128 | ||
372 | -no file open, try 'help open' | ||
373 | can't open device TEST_DIR/t.vpc: Invalid block size 305419896 | ||
374 | -no file open, try 'help open' | ||
375 | can't open device TEST_DIR/t.vpc: Invalid block size 305419896 | ||
376 | -no file open, try 'help open' | ||
377 | *** done | ||
378 | diff --git a/tests/qemu-iotests/092.out b/tests/qemu-iotests/092.out | ||
379 | index XXXXXXX..XXXXXXX 100644 | ||
380 | --- a/tests/qemu-iotests/092.out | ||
381 | +++ b/tests/qemu-iotests/092.out | ||
382 | @@ -XXX,XX +XXX,XX @@ QA output created by 092 | ||
383 | == Invalid cluster size == | ||
384 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
385 | can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k | ||
386 | -no file open, try 'help open' | ||
387 | can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k | ||
388 | -no file open, try 'help open' | ||
389 | can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k | ||
390 | -no file open, try 'help open' | ||
391 | can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k | ||
392 | -no file open, try 'help open' | ||
393 | |||
394 | == Invalid L2 table size == | ||
395 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
396 | can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 64k | ||
397 | -no file open, try 'help open' | ||
398 | can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 64k | ||
399 | -no file open, try 'help open' | ||
400 | can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 64k | ||
401 | -no file open, try 'help open' | ||
402 | can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 64k | ||
403 | -no file open, try 'help open' | ||
404 | |||
405 | == Invalid size == | ||
406 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
407 | can't open device TEST_DIR/t.qcow: Image too large | ||
408 | -no file open, try 'help open' | ||
409 | can't open device TEST_DIR/t.qcow: Image too large | ||
410 | -no file open, try 'help open' | ||
411 | |||
412 | == Invalid backing file length == | ||
413 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 | ||
414 | can't open device TEST_DIR/t.qcow: Backing file name too long | ||
415 | -no file open, try 'help open' | ||
416 | can't open device TEST_DIR/t.qcow: Backing file name too long | ||
417 | -no file open, try 'help open' | ||
418 | *** done | ||
419 | diff --git a/tests/qemu-iotests/116.out b/tests/qemu-iotests/116.out | ||
420 | index XXXXXXX..XXXXXXX 100644 | ||
421 | --- a/tests/qemu-iotests/116.out | ||
422 | +++ b/tests/qemu-iotests/116.out | ||
423 | @@ -XXX,XX +XXX,XX @@ QA output created by 116 | ||
424 | == truncated header cluster == | ||
425 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
426 | can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
427 | -no file open, try 'help open' | ||
428 | |||
429 | == invalid header magic == | ||
430 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
431 | can't open device TEST_DIR/t.qed: Image not in QED format | ||
432 | -no file open, try 'help open' | ||
433 | |||
434 | == invalid cluster size == | ||
435 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
436 | can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
437 | -no file open, try 'help open' | ||
438 | |||
439 | == invalid table size == | ||
440 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
441 | can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
442 | -no file open, try 'help open' | ||
443 | |||
444 | == invalid header size == | ||
445 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
446 | can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
447 | -no file open, try 'help open' | ||
448 | |||
449 | == invalid L1 table offset == | ||
450 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
451 | can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
452 | -no file open, try 'help open' | ||
453 | |||
454 | == invalid image size == | ||
455 | Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 | ||
456 | can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid argument | ||
457 | -no file open, try 'help open' | ||
458 | *** done | ||
459 | diff --git a/tests/qemu-iotests/131.out b/tests/qemu-iotests/131.out | ||
460 | index XXXXXXX..XXXXXXX 100644 | ||
461 | --- a/tests/qemu-iotests/131.out | ||
462 | +++ b/tests/qemu-iotests/131.out | ||
463 | @@ -XXX,XX +XXX,XX @@ read 32768/32768 bytes at offset 0 | ||
464 | 32 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
465 | == Corrupt image == | ||
466 | can't open device TEST_DIR/t.parallels: parallels: Image was not closed correctly; cannot be opened read/write | ||
467 | -no file open, try 'help open' | ||
468 | ERROR image was not closed correctly | ||
469 | |||
470 | 1 errors were found on the image. | ||
471 | diff --git a/tests/qemu-iotests/140.out b/tests/qemu-iotests/140.out | ||
472 | index XXXXXXX..XXXXXXX 100644 | ||
473 | --- a/tests/qemu-iotests/140.out | ||
474 | +++ b/tests/qemu-iotests/140.out | ||
475 | @@ -XXX,XX +XXX,XX @@ read 65536/65536 bytes at offset 0 | ||
476 | 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
477 | {"return": {}} | ||
478 | can't open device nbd+unix:///drv?socket=TEST_DIR/nbd: No export with name 'drv' available | ||
479 | -no file open, try 'help open' | ||
480 | {"return": {}} | ||
481 | {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} | ||
482 | *** done | ||
483 | -- | ||
484 | 2.11.0 | ||
485 | |||
486 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Nir Soffer <nirsof@gmail.com> | ||
2 | 1 | ||
3 | This helper allows adding tests supporting any format expect the | ||
4 | specified formats. This may be useful to test that many formats behave | ||
5 | in a common way. | ||
6 | |||
7 | Signed-off-by: Nir Soffer <nirsof@gmail.com> | ||
8 | Message-id: 20170201003120.23378-3-nirsof@gmail.com | ||
9 | Reviewed-by: Max Reitz <mreitz@redhat.com> | ||
10 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
11 | --- | ||
12 | tests/qemu-iotests/common.rc | 11 +++++++++++ | ||
13 | 1 file changed, 11 insertions(+) | ||
14 | |||
15 | diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/tests/qemu-iotests/common.rc | ||
18 | +++ b/tests/qemu-iotests/common.rc | ||
19 | @@ -XXX,XX +XXX,XX @@ _supported_fmt() | ||
20 | _notrun "not suitable for this image format: $IMGFMT" | ||
21 | } | ||
22 | |||
23 | +# tests whether $IMGFMT is one of the unsupported image format for a test | ||
24 | +# | ||
25 | +_unsupported_fmt() | ||
26 | +{ | ||
27 | + for f; do | ||
28 | + if [ "$f" = "$IMGFMT" ]; then | ||
29 | + _notrun "not suitable for this image format: $IMGFMT" | ||
30 | + fi | ||
31 | + done | ||
32 | +} | ||
33 | + | ||
34 | # tests whether $IMGPROTO is one of the supported image protocols for a test | ||
35 | # | ||
36 | _supported_proto() | ||
37 | -- | ||
38 | 2.11.0 | ||
39 | |||
40 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Nir Soffer <nirsof@gmail.com> | ||
2 | 1 | ||
3 | Add regression tests checking that qemu-io fails with non-zero exit code | ||
4 | when reading non-existing file or using the wrong image format. | ||
5 | |||
6 | Signed-off-by: Nir Soffer <nirsof@gmail.com> | ||
7 | Message-id: 20170201003120.23378-4-nirsof@gmail.com | ||
8 | Reviewed-by: Max Reitz <mreitz@redhat.com> | ||
9 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
10 | --- | ||
11 | tests/qemu-iotests/174 | 59 ++++++++++++++++++++++++++++++++++++++++++++++ | ||
12 | tests/qemu-iotests/174.out | 7 ++++++ | ||
13 | tests/qemu-iotests/group | 1 + | ||
14 | 3 files changed, 67 insertions(+) | ||
15 | create mode 100755 tests/qemu-iotests/174 | ||
16 | create mode 100644 tests/qemu-iotests/174.out | ||
17 | |||
18 | diff --git a/tests/qemu-iotests/174 b/tests/qemu-iotests/174 | ||
19 | new file mode 100755 | ||
20 | index XXXXXXX..XXXXXXX | ||
21 | --- /dev/null | ||
22 | +++ b/tests/qemu-iotests/174 | ||
23 | @@ -XXX,XX +XXX,XX @@ | ||
24 | +#!/bin/bash | ||
25 | +# | ||
26 | +# Test that qemu-io fail with non-zero exit code | ||
27 | +# | ||
28 | +# Copyright (C) 2017 Nir Soffer <nirsof@gmail.com> | ||
29 | +# | ||
30 | +# This program is free software; you can redistribute it and/or modify | ||
31 | +# it under the terms of the GNU General Public License as published by | ||
32 | +# the Free Software Foundation; either version 2 of the License, or | ||
33 | +# (at your option) any later version. | ||
34 | +# | ||
35 | +# This program is distributed in the hope that it will be useful, | ||
36 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
37 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
38 | +# GNU General Public License for more details. | ||
39 | +# | ||
40 | +# You should have received a copy of the GNU General Public License | ||
41 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
42 | +# | ||
43 | + | ||
44 | +# creator | ||
45 | +owner=nirsof@gmail.com | ||
46 | + | ||
47 | +seq=`basename $0` | ||
48 | +echo "QA output created by $seq" | ||
49 | + | ||
50 | +here=`pwd` | ||
51 | +status=1 # failure is the default! | ||
52 | + | ||
53 | +_cleanup() | ||
54 | +{ | ||
55 | + _cleanup_test_img | ||
56 | +} | ||
57 | +trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
58 | + | ||
59 | +# get standard environment, filters and checks | ||
60 | +. ./common.rc | ||
61 | +. ./common.filter | ||
62 | + | ||
63 | +_unsupported_fmt raw | ||
64 | + | ||
65 | + | ||
66 | +size=256K | ||
67 | +IMGFMT=raw IMGOPTS= _make_test_img $size | _filter_imgfmt | ||
68 | + | ||
69 | +echo | ||
70 | +echo "== reading wrong format should fail ==" | ||
71 | +$QEMU_IO -f $IMGFMT -c "read 0 $size" "$TEST_IMG" 2>/dev/null | ||
72 | +test $? -eq 1 || _fail "did not fail" | ||
73 | + | ||
74 | +echo | ||
75 | +echo "== reading missing file should fail ==" | ||
76 | +$QEMU_IO -c "read 0 $size" "$TEST_DIR/missing" 2>/dev/null | ||
77 | +test $? -eq 1 || _fail "did not fail" | ||
78 | + | ||
79 | +# success, all done | ||
80 | +echo "*** done" | ||
81 | +rm -f $seq.full | ||
82 | +status=0 | ||
83 | diff --git a/tests/qemu-iotests/174.out b/tests/qemu-iotests/174.out | ||
84 | new file mode 100644 | ||
85 | index XXXXXXX..XXXXXXX | ||
86 | --- /dev/null | ||
87 | +++ b/tests/qemu-iotests/174.out | ||
88 | @@ -XXX,XX +XXX,XX @@ | ||
89 | +QA output created by 174 | ||
90 | +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=262144 | ||
91 | + | ||
92 | +== reading wrong format should fail == | ||
93 | + | ||
94 | +== reading missing file should fail == | ||
95 | +*** done | ||
96 | diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group | ||
97 | index XXXXXXX..XXXXXXX 100644 | ||
98 | --- a/tests/qemu-iotests/group | ||
99 | +++ b/tests/qemu-iotests/group | ||
100 | @@ -XXX,XX +XXX,XX @@ | ||
101 | 171 rw auto quick | ||
102 | 172 auto | ||
103 | 173 rw auto | ||
104 | +174 auto | ||
105 | -- | ||
106 | 2.11.0 | ||
107 | |||
108 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alberto Garcia <berto@igalia.com> | ||
2 | 1 | ||
3 | The metadata overlap checks introduced in a40f1c2add help detect | ||
4 | corruption in the qcow2 image by verifying that data writes don't | ||
5 | overlap with existing metadata sections. | ||
6 | |||
7 | The 'refcount-block' check in particular iterates over the refcount | ||
8 | table in order to get the addresses of all refcount blocks and check | ||
9 | that none of them overlap with the region where we want to write. | ||
10 | |||
11 | The problem with the refcount table is that since it always occupies | ||
12 | complete clusters its size is usually very big. With the default | ||
13 | values of cluster_size=64KB and refcount_bits=16 this table holds 8192 | ||
14 | entries, each one of them enough to map 2GB worth of host clusters. | ||
15 | |||
16 | So unless we're using images with several TB of allocated data this | ||
17 | table is going to be mostly empty, and iterating over it is a waste of | ||
18 | CPU. If the storage backend is fast enough this can have an effect on | ||
19 | I/O performance. | ||
20 | |||
21 | This patch keeps the index of the last used (i.e. non-zero) entry in | ||
22 | the refcount table and updates it every time the table changes. The | ||
23 | refcount-block overlap check then uses that index instead of reading | ||
24 | the whole table. | ||
25 | |||
26 | In my tests with a 4GB qcow2 file stored in RAM this doubles the | ||
27 | amount of write IOPS. | ||
28 | |||
29 | Signed-off-by: Alberto Garcia <berto@igalia.com> | ||
30 | Message-id: 20170201123828.4815-1-berto@igalia.com | ||
31 | Reviewed-by: Max Reitz <mreitz@redhat.com> | ||
32 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
33 | --- | ||
34 | block/qcow2.h | 1 + | ||
35 | block/qcow2-refcount.c | 24 +++++++++++++++++++++++- | ||
36 | block/qcow2.c | 1 + | ||
37 | 3 files changed, 25 insertions(+), 1 deletion(-) | ||
38 | |||
39 | diff --git a/block/qcow2.h b/block/qcow2.h | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/block/qcow2.h | ||
42 | +++ b/block/qcow2.h | ||
43 | @@ -XXX,XX +XXX,XX @@ typedef struct BDRVQcow2State { | ||
44 | uint64_t *refcount_table; | ||
45 | uint64_t refcount_table_offset; | ||
46 | uint32_t refcount_table_size; | ||
47 | + uint32_t max_refcount_table_index; /* Last used entry in refcount_table */ | ||
48 | uint64_t free_cluster_index; | ||
49 | uint64_t free_byte_offset; | ||
50 | |||
51 | diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c | ||
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/block/qcow2-refcount.c | ||
54 | +++ b/block/qcow2-refcount.c | ||
55 | @@ -XXX,XX +XXX,XX @@ static Qcow2SetRefcountFunc *const set_refcount_funcs[] = { | ||
56 | /*********************************************************/ | ||
57 | /* refcount handling */ | ||
58 | |||
59 | +static void update_max_refcount_table_index(BDRVQcow2State *s) | ||
60 | +{ | ||
61 | + unsigned i = s->refcount_table_size - 1; | ||
62 | + while (i > 0 && (s->refcount_table[i] & REFT_OFFSET_MASK) == 0) { | ||
63 | + i--; | ||
64 | + } | ||
65 | + /* Set s->max_refcount_table_index to the index of the last used entry */ | ||
66 | + s->max_refcount_table_index = i; | ||
67 | +} | ||
68 | + | ||
69 | int qcow2_refcount_init(BlockDriverState *bs) | ||
70 | { | ||
71 | BDRVQcow2State *s = bs->opaque; | ||
72 | @@ -XXX,XX +XXX,XX @@ int qcow2_refcount_init(BlockDriverState *bs) | ||
73 | } | ||
74 | for(i = 0; i < s->refcount_table_size; i++) | ||
75 | be64_to_cpus(&s->refcount_table[i]); | ||
76 | + update_max_refcount_table_index(s); | ||
77 | } | ||
78 | return 0; | ||
79 | fail: | ||
80 | @@ -XXX,XX +XXX,XX @@ static int alloc_refcount_block(BlockDriverState *bs, | ||
81 | } | ||
82 | |||
83 | s->refcount_table[refcount_table_index] = new_block; | ||
84 | + /* If there's a hole in s->refcount_table then it can happen | ||
85 | + * that refcount_table_index < s->max_refcount_table_index */ | ||
86 | + s->max_refcount_table_index = | ||
87 | + MAX(s->max_refcount_table_index, refcount_table_index); | ||
88 | |||
89 | /* The new refcount block may be where the caller intended to put its | ||
90 | * data, so let it restart the search. */ | ||
91 | @@ -XXX,XX +XXX,XX @@ static int alloc_refcount_block(BlockDriverState *bs, | ||
92 | s->refcount_table = new_table; | ||
93 | s->refcount_table_size = table_size; | ||
94 | s->refcount_table_offset = table_offset; | ||
95 | + update_max_refcount_table_index(s); | ||
96 | |||
97 | /* Free old table. */ | ||
98 | qcow2_free_clusters(bs, old_table_offset, old_table_size * sizeof(uint64_t), | ||
99 | @@ -XXX,XX +XXX,XX @@ write_refblocks: | ||
100 | s->refcount_table = on_disk_reftable; | ||
101 | s->refcount_table_offset = reftable_offset; | ||
102 | s->refcount_table_size = reftable_size; | ||
103 | + update_max_refcount_table_index(s); | ||
104 | |||
105 | return 0; | ||
106 | |||
107 | @@ -XXX,XX +XXX,XX @@ int qcow2_check_metadata_overlap(BlockDriverState *bs, int ign, int64_t offset, | ||
108 | } | ||
109 | |||
110 | if ((chk & QCOW2_OL_REFCOUNT_BLOCK) && s->refcount_table) { | ||
111 | - for (i = 0; i < s->refcount_table_size; i++) { | ||
112 | + unsigned last_entry = s->max_refcount_table_index; | ||
113 | + assert(last_entry < s->refcount_table_size); | ||
114 | + assert(last_entry + 1 == s->refcount_table_size || | ||
115 | + (s->refcount_table[last_entry + 1] & REFT_OFFSET_MASK) == 0); | ||
116 | + for (i = 0; i <= last_entry; i++) { | ||
117 | if ((s->refcount_table[i] & REFT_OFFSET_MASK) && | ||
118 | overlaps_with(s->refcount_table[i] & REFT_OFFSET_MASK, | ||
119 | s->cluster_size)) { | ||
120 | @@ -XXX,XX +XXX,XX @@ int qcow2_change_refcount_order(BlockDriverState *bs, int refcount_order, | ||
121 | /* Now update the rest of the in-memory information */ | ||
122 | old_reftable = s->refcount_table; | ||
123 | s->refcount_table = new_reftable; | ||
124 | + update_max_refcount_table_index(s); | ||
125 | |||
126 | s->refcount_bits = 1 << refcount_order; | ||
127 | s->refcount_max = UINT64_C(1) << (s->refcount_bits - 1); | ||
128 | diff --git a/block/qcow2.c b/block/qcow2.c | ||
129 | index XXXXXXX..XXXXXXX 100644 | ||
130 | --- a/block/qcow2.c | ||
131 | +++ b/block/qcow2.c | ||
132 | @@ -XXX,XX +XXX,XX @@ static int make_completely_empty(BlockDriverState *bs) | ||
133 | |||
134 | s->refcount_table_offset = s->cluster_size; | ||
135 | s->refcount_table_size = s->cluster_size / sizeof(uint64_t); | ||
136 | + s->max_refcount_table_index = 0; | ||
137 | |||
138 | g_free(s->refcount_table); | ||
139 | s->refcount_table = new_reftable; | ||
140 | -- | ||
141 | 2.11.0 | ||
142 | |||
143 | diff view generated by jsdifflib |
1 | From: Alberto Garcia <berto@igalia.com> | 1 | From: Liu Yiding <liuyd.fnst@fujitsu.com> |
---|---|---|---|
2 | 2 | ||
3 | Passing a request size larger than BDRV_REQUEST_MAX_BYTES to any of the | 3 | virtiofsd has introduced killpriv_v2/no_killpriv_v2 for a while. Add |
4 | I/O commands results in an error. While 'read' and 'write' handle the | 4 | description of it to docs/helper. |
5 | error correctly, 'aio_read' and 'aio_write' hit an assertion: | ||
6 | 5 | ||
7 | blk_aio_read_entry: Assertion `rwco->qiov->size == acb->bytes' failed. | 6 | Signed-off-by: Liu Yiding <liuyd.fnst@fujitsu.com> |
7 | Message-Id: <20220421095151.2231099-1-liuyd.fnst@fujitsu.com> | ||
8 | 8 | ||
9 | The reason is that the QEMU I/O code cannot handle request sizes | 9 | [Small documentation fixes: s/as client supports/as the client supports/ |
10 | larger than BDRV_REQUEST_MAX_BYTES, so this patch makes qemu-io check | 10 | and s/. /. /. |
11 | that all values are within range. | 11 | --Stefan] |
12 | 12 | ||
13 | Signed-off-by: Alberto Garcia <berto@igalia.com> | 13 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
14 | Message-id: 79f66648c685929a144396bda24d13a207131dcf.1485878688.git.berto@igalia.com | ||
15 | [mreitz: Use BDRV_REQUEST_MAX_BYTES instead of INT_MAX] | ||
16 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
17 | --- | 14 | --- |
18 | qemu-io-cmds.c | 20 +++++++++++++------- | 15 | docs/tools/virtiofsd.rst | 5 +++++ |
19 | 1 file changed, 13 insertions(+), 7 deletions(-) | 16 | tools/virtiofsd/helper.c | 3 +++ |
17 | 2 files changed, 8 insertions(+) | ||
20 | 18 | ||
21 | diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c | 19 | diff --git a/docs/tools/virtiofsd.rst b/docs/tools/virtiofsd.rst |
22 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/qemu-io-cmds.c | 21 | --- a/docs/tools/virtiofsd.rst |
24 | +++ b/qemu-io-cmds.c | 22 | +++ b/docs/tools/virtiofsd.rst |
25 | @@ -XXX,XX +XXX,XX @@ create_iovec(BlockBackend *blk, QEMUIOVector *qiov, char **argv, int nr_iov, | 23 | @@ -XXX,XX +XXX,XX @@ Options |
26 | goto fail; | 24 | label. Server will try to set that label on newly created file |
27 | } | 25 | atomically wherever possible. |
28 | 26 | ||
29 | - if (len > SIZE_MAX) { | 27 | + * killpriv_v2|no_killpriv_v2 - |
30 | - printf("Argument '%s' exceeds maximum size %llu\n", arg, | 28 | + Enable/disable ``FUSE_HANDLE_KILLPRIV_V2`` support. KILLPRIV_V2 is enabled |
31 | - (unsigned long long)SIZE_MAX); | 29 | + by default as long as the client supports it. Enabling this option helps |
32 | + if (len > BDRV_REQUEST_MAX_BYTES) { | 30 | + with performance in write path. |
33 | + printf("Argument '%s' exceeds maximum size %" PRIu64 "\n", arg, | ||
34 | + (uint64_t)BDRV_REQUEST_MAX_BYTES); | ||
35 | + goto fail; | ||
36 | + } | ||
37 | + | 31 | + |
38 | + if (count > BDRV_REQUEST_MAX_BYTES - len) { | 32 | .. option:: --socket-path=PATH |
39 | + printf("The total number of bytes exceed the maximum size %" PRIu64 | 33 | |
40 | + "\n", (uint64_t)BDRV_REQUEST_MAX_BYTES); | 34 | Listen on vhost-user UNIX domain socket at PATH. |
41 | goto fail; | 35 | diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c |
42 | } | 36 | index XXXXXXX..XXXXXXX 100644 |
43 | 37 | --- a/tools/virtiofsd/helper.c | |
44 | @@ -XXX,XX +XXX,XX @@ static int read_f(BlockBackend *blk, int argc, char **argv) | 38 | +++ b/tools/virtiofsd/helper.c |
45 | if (count < 0) { | 39 | @@ -XXX,XX +XXX,XX @@ void fuse_cmdline_help(void) |
46 | print_cvtnum_err(count, argv[optind]); | 40 | " -o announce_submounts Announce sub-mount points to the guest\n" |
47 | return 0; | 41 | " -o posix_acl/no_posix_acl Enable/Disable posix_acl. (default: disabled)\n" |
48 | - } else if (count > SIZE_MAX) { | 42 | " -o security_label/no_security_label Enable/Disable security label. (default: disabled)\n" |
49 | + } else if (count > BDRV_REQUEST_MAX_BYTES) { | 43 | + " -o killpriv_v2/no_killpriv_v2\n" |
50 | printf("length cannot exceed %" PRIu64 ", given %s\n", | 44 | + " Enable/Disable FUSE_HANDLE_KILLPRIV_V2.\n" |
51 | - (uint64_t) SIZE_MAX, argv[optind]); | 45 | + " (default: enabled as long as client supports it)\n" |
52 | + (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]); | 46 | ); |
53 | return 0; | 47 | } |
54 | } | ||
55 | |||
56 | @@ -XXX,XX +XXX,XX @@ static int write_f(BlockBackend *blk, int argc, char **argv) | ||
57 | if (count < 0) { | ||
58 | print_cvtnum_err(count, argv[optind]); | ||
59 | return 0; | ||
60 | - } else if (count > SIZE_MAX) { | ||
61 | + } else if (count > BDRV_REQUEST_MAX_BYTES) { | ||
62 | printf("length cannot exceed %" PRIu64 ", given %s\n", | ||
63 | - (uint64_t) SIZE_MAX, argv[optind]); | ||
64 | + (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]); | ||
65 | return 0; | ||
66 | } | ||
67 | 48 | ||
68 | -- | 49 | -- |
69 | 2.11.0 | 50 | 2.35.1 |
70 | |||
71 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Peter Maydell <peter.maydell@linaro.org> | ||
2 | 1 | ||
3 | Some of the argument parsing in qemu-img uses strtoul() to parse | ||
4 | integer arguments. This is tricky to get correct and in fact the | ||
5 | code does not get it right, because it assigns the result of | ||
6 | strtoul() to an 'int' variable and then tries to check for > INT_MAX. | ||
7 | Coverity correctly complains that the comparison is always false. | ||
8 | |||
9 | Rewrite to use qemu_strtoul(), which has a saner convention for | ||
10 | reporting conversion failures. | ||
11 | |||
12 | (Fixes CID 1356421, CID 1356422, CID 1356423.) | ||
13 | |||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Message-id: 1486744104-15590-2-git-send-email-peter.maydell@linaro.org | ||
16 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
17 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
18 | --- | ||
19 | qemu-img.c | 32 ++++++++++++++++---------------- | ||
20 | 1 file changed, 16 insertions(+), 16 deletions(-) | ||
21 | |||
22 | diff --git a/qemu-img.c b/qemu-img.c | ||
23 | index XXXXXXX..XXXXXXX 100644 | ||
24 | --- a/qemu-img.c | ||
25 | +++ b/qemu-img.c | ||
26 | @@ -XXX,XX +XXX,XX @@ static int img_bench(int argc, char **argv) | ||
27 | break; | ||
28 | case 'c': | ||
29 | { | ||
30 | - char *end; | ||
31 | - errno = 0; | ||
32 | - count = strtoul(optarg, &end, 0); | ||
33 | - if (errno || *end || count > INT_MAX) { | ||
34 | + unsigned long res; | ||
35 | + | ||
36 | + if (qemu_strtoul(optarg, NULL, 0, &res) < 0 || res > INT_MAX) { | ||
37 | error_report("Invalid request count specified"); | ||
38 | return 1; | ||
39 | } | ||
40 | + count = res; | ||
41 | break; | ||
42 | } | ||
43 | case 'd': | ||
44 | { | ||
45 | - char *end; | ||
46 | - errno = 0; | ||
47 | - depth = strtoul(optarg, &end, 0); | ||
48 | - if (errno || *end || depth > INT_MAX) { | ||
49 | + unsigned long res; | ||
50 | + | ||
51 | + if (qemu_strtoul(optarg, NULL, 0, &res) < 0 || res > INT_MAX) { | ||
52 | error_report("Invalid queue depth specified"); | ||
53 | return 1; | ||
54 | } | ||
55 | + depth = res; | ||
56 | break; | ||
57 | } | ||
58 | case 'f': | ||
59 | @@ -XXX,XX +XXX,XX @@ static int img_bench(int argc, char **argv) | ||
60 | break; | ||
61 | case OPTION_PATTERN: | ||
62 | { | ||
63 | - char *end; | ||
64 | - errno = 0; | ||
65 | - pattern = strtoul(optarg, &end, 0); | ||
66 | - if (errno || *end || pattern > 0xff) { | ||
67 | + unsigned long res; | ||
68 | + | ||
69 | + if (qemu_strtoul(optarg, NULL, 0, &res) < 0 || res > 0xff) { | ||
70 | error_report("Invalid pattern byte specified"); | ||
71 | return 1; | ||
72 | } | ||
73 | + pattern = res; | ||
74 | break; | ||
75 | } | ||
76 | case OPTION_FLUSH_INTERVAL: | ||
77 | { | ||
78 | - char *end; | ||
79 | - errno = 0; | ||
80 | - flush_interval = strtoul(optarg, &end, 0); | ||
81 | - if (errno || *end || flush_interval > INT_MAX) { | ||
82 | + unsigned long res; | ||
83 | + | ||
84 | + if (qemu_strtoul(optarg, NULL, 0, &res) < 0 || res > INT_MAX) { | ||
85 | error_report("Invalid flush interval specified"); | ||
86 | return 1; | ||
87 | } | ||
88 | + flush_interval = res; | ||
89 | break; | ||
90 | } | ||
91 | case OPTION_NO_DRAIN: | ||
92 | -- | ||
93 | 2.11.0 | ||
94 | |||
95 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Peter Maydell <peter.maydell@linaro.org> | ||
2 | 1 | ||
3 | Coverity points out that we assign the return value from | ||
4 | bdrv_snapshot_load_tmp() to 'ret' in img_convert(), but then | ||
5 | never use that variable. (We check for failure by looking | ||
6 | at local_err instead.) Drop the unused assignment, bringing | ||
7 | the call into line with the following call to | ||
8 | bdrv_snapshot_laod_tmp_by_id_or_name(). | ||
9 | |||
10 | (Fixes CID 1247240.) | ||
11 | |||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Message-id: 1486744104-15590-3-git-send-email-peter.maydell@linaro.org | ||
14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
16 | --- | ||
17 | qemu-img.c | 8 ++++---- | ||
18 | 1 file changed, 4 insertions(+), 4 deletions(-) | ||
19 | |||
20 | diff --git a/qemu-img.c b/qemu-img.c | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/qemu-img.c | ||
23 | +++ b/qemu-img.c | ||
24 | @@ -XXX,XX +XXX,XX @@ static int img_convert(int argc, char **argv) | ||
25 | } | ||
26 | |||
27 | if (sn_opts) { | ||
28 | - ret = bdrv_snapshot_load_tmp(bs[0], | ||
29 | - qemu_opt_get(sn_opts, SNAPSHOT_OPT_ID), | ||
30 | - qemu_opt_get(sn_opts, SNAPSHOT_OPT_NAME), | ||
31 | - &local_err); | ||
32 | + bdrv_snapshot_load_tmp(bs[0], | ||
33 | + qemu_opt_get(sn_opts, SNAPSHOT_OPT_ID), | ||
34 | + qemu_opt_get(sn_opts, SNAPSHOT_OPT_NAME), | ||
35 | + &local_err); | ||
36 | } else if (snapshot_name != NULL) { | ||
37 | if (bs_n > 1) { | ||
38 | error_report("No support for concatenating multiple snapshot"); | ||
39 | -- | ||
40 | 2.11.0 | ||
41 | |||
42 | diff view generated by jsdifflib |