1 | The following changes since commit d01beac177d44491d7db8747b79d94e1b53d173b: | 1 | The following changes since commit 15ef89d2a1a7b93845a6b09c2ee8e1979f6eb30b: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/kraxel/tags/vga-20180507-pull-request' into staging (2018-05-08 14:23:02 +0100) | 3 | Update version for v7.0.0-rc1 release (2022-03-22 22:58:44 +0000) |
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://gitlab.com/stefanha/qemu.git tags/block-pull-request |
8 | 8 | ||
9 | for you to fetch changes up to a2cb9239b7610ffb00f9ced5cd7640d40b0e1ccf: | 9 | for you to fetch changes up to 2539eade4f689eda7e9fe45486f18334bfbafaf0: |
10 | 10 | ||
11 | sheepdog: Fix sd_co_create_opts() memory leaks (2018-05-08 10:47:27 -0400) | 11 | hw: Fix misleading hexadecimal format (2022-03-24 10:38:42 +0000) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Block patches | 14 | Pull request |
15 | |||
16 | Philippe found cases where the 0x%d format string was used, leading to | ||
17 | misleading output. The patches look harmless and could save people time, so I | ||
18 | think it's worth including them in 7.0. | ||
19 | |||
15 | ---------------------------------------------------------------- | 20 | ---------------------------------------------------------------- |
16 | 21 | ||
17 | Kevin Wolf (1): | 22 | Philippe Mathieu-Daudé (2): |
18 | sheepdog: Fix sd_co_create_opts() memory leaks | 23 | block: Fix misleading hexadecimal format |
24 | hw: Fix misleading hexadecimal format | ||
19 | 25 | ||
20 | Max Reitz (2): | 26 | block/parallels-ext.c | 2 +- |
21 | block/mirror: Make cancel always cancel pre-READY | 27 | hw/i386/sgx.c | 2 +- |
22 | iotests: Add test for cancelling a mirror job | 28 | hw/i386/trace-events | 6 +++--- |
23 | 29 | hw/misc/trace-events | 4 ++-- | |
24 | Stefan Hajnoczi (1): | 30 | hw/scsi/trace-events | 4 ++-- |
25 | block/mirror: honor ratelimit again | 31 | 5 files changed, 9 insertions(+), 9 deletions(-) |
26 | |||
27 | block/mirror.c | 14 +++-- | ||
28 | block/sheepdog.c | 4 +- | ||
29 | tests/qemu-iotests/185.out | 4 +- | ||
30 | tests/qemu-iotests/218 | 138 +++++++++++++++++++++++++++++++++++++++++++++ | ||
31 | tests/qemu-iotests/218.out | 30 ++++++++++ | ||
32 | tests/qemu-iotests/group | 1 + | ||
33 | 6 files changed, 183 insertions(+), 8 deletions(-) | ||
34 | create mode 100644 tests/qemu-iotests/218 | ||
35 | create mode 100644 tests/qemu-iotests/218.out | ||
36 | 32 | ||
37 | -- | 33 | -- |
38 | 2.13.6 | 34 | 2.35.1 |
39 | 35 | ||
40 | diff view generated by jsdifflib |
1 | From: Kevin Wolf <kwolf@redhat.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Both the option string for the 'redundancy' option and the | 3 | "0x%u" format is very misleading, replace by "0x%x". |
4 | SheepdogRedundancy object that is created accordingly could be leaked in | ||
5 | error paths. This fixes the memory leaks. | ||
6 | 4 | ||
7 | Reported by Coverity (CID 1390614 and 1390641). | 5 | Found running: |
8 | 6 | ||
9 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 7 | $ git grep -E '0x%[0-9]*([lL]*|" ?PRI)[dDuU]' block/ |
10 | Message-id: 20180503153509.22223-1-kwolf@redhat.com | 8 | |
11 | Reviewed-by: Jeff Cody <jcody@redhat.com> | 9 | Inspired-by: Richard Henderson <richard.henderson@linaro.org> |
12 | Signed-off-by: Jeff Cody <jcody@redhat.com> | 10 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
11 | Reviewed-by: Hanna Reitz <hreitz@redhat.com> | ||
12 | Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> | ||
13 | Reviewed-by: Denis V. Lunev <den@openvz.org> | ||
14 | Message-id: 20220323114718.58714-2-philippe.mathieu.daude@gmail.com | ||
15 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
13 | --- | 16 | --- |
14 | block/sheepdog.c | 4 +++- | 17 | block/parallels-ext.c | 2 +- |
15 | 1 file changed, 3 insertions(+), 1 deletion(-) | 18 | 1 file changed, 1 insertion(+), 1 deletion(-) |
16 | 19 | ||
17 | diff --git a/block/sheepdog.c b/block/sheepdog.c | 20 | diff --git a/block/parallels-ext.c b/block/parallels-ext.c |
18 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/block/sheepdog.c | 22 | --- a/block/parallels-ext.c |
20 | +++ b/block/sheepdog.c | 23 | +++ b/block/parallels-ext.c |
21 | @@ -XXX,XX +XXX,XX @@ static SheepdogRedundancy *parse_redundancy_str(const char *opt) | 24 | @@ -XXX,XX +XXX,XX @@ static int parallels_parse_format_extension(BlockDriverState *bs, |
22 | } else { | 25 | break; |
23 | ret = qemu_strtol(n2, NULL, 10, &parity); | 26 | |
24 | if (ret < 0) { | 27 | default: |
25 | + g_free(redundancy); | 28 | - error_setg(errp, "Unknown feature: 0x%" PRIu64, fh.magic); |
26 | return NULL; | 29 | + error_setg(errp, "Unknown feature: 0x%" PRIx64, fh.magic); |
30 | goto fail; | ||
27 | } | 31 | } |
28 | 32 | ||
29 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn sd_co_create_opts(const char *filename, QemuOpts *opts, | ||
30 | QDict *qdict, *location_qdict; | ||
31 | QObject *crumpled; | ||
32 | Visitor *v; | ||
33 | - const char *redundancy; | ||
34 | + char *redundancy; | ||
35 | Error *local_err = NULL; | ||
36 | int ret; | ||
37 | |||
38 | @@ -XXX,XX +XXX,XX @@ static int coroutine_fn sd_co_create_opts(const char *filename, QemuOpts *opts, | ||
39 | fail: | ||
40 | qapi_free_BlockdevCreateOptions(create_options); | ||
41 | qobject_unref(qdict); | ||
42 | + g_free(redundancy); | ||
43 | return ret; | ||
44 | } | ||
45 | |||
46 | -- | 33 | -- |
47 | 2.13.6 | 34 | 2.35.1 |
48 | 35 | ||
49 | 36 | diff view generated by jsdifflib |
1 | From: Stefan Hajnoczi <stefanha@redhat.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Commit b76e4458b1eb3c32e9824fe6aa51f67d2b251748 ("block/mirror: change | 3 | "0x%u" format is very misleading, replace by "0x%x". |
4 | the semantic of 'force' of block-job-cancel") accidentally removed the | ||
5 | ratelimit in the mirror job. | ||
6 | 4 | ||
7 | Reintroduce the ratelimit but keep the block-job-cancel force=true | 5 | Found running: |
8 | behavior that was added in commit | ||
9 | b76e4458b1eb3c32e9824fe6aa51f67d2b251748. | ||
10 | 6 | ||
11 | Note that block_job_sleep_ns() returns immediately when the job is | 7 | $ git grep -E '0x%[0-9]*([lL]*|" ?PRI)[dDuU]' hw/ |
12 | cancelled. Therefore it's safe to unconditionally call | ||
13 | block_job_sleep_ns() - a cancelled job does not sleep. | ||
14 | 8 | ||
15 | This commit fixes the non-deterministic qemu-iotests 185 output. The | 9 | Inspired-by: Richard Henderson <richard.henderson@linaro.org> |
16 | test relies on the ratelimit to make the job sleep until the 'quit' | 10 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
17 | command is processed. Previously the job could complete before the | 11 | Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> |
18 | 'quit' command was received since there was no ratelimit. | 12 | Message-id: 20220323114718.58714-3-philippe.mathieu.daude@gmail.com |
13 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
14 | --- | ||
15 | hw/i386/sgx.c | 2 +- | ||
16 | hw/i386/trace-events | 6 +++--- | ||
17 | hw/misc/trace-events | 4 ++-- | ||
18 | hw/scsi/trace-events | 4 ++-- | ||
19 | 4 files changed, 8 insertions(+), 8 deletions(-) | ||
19 | 20 | ||
20 | Cc: Liang Li <liliang.opensource@gmail.com> | 21 | diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c |
21 | Cc: Jeff Cody <jcody@redhat.com> | ||
22 | Cc: Kevin Wolf <kwolf@redhat.com> | ||
23 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
24 | Message-id: 20180424123527.19168-1-stefanha@redhat.com | ||
25 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
26 | --- | ||
27 | block/mirror.c | 8 +++++--- | ||
28 | tests/qemu-iotests/185.out | 4 ++-- | ||
29 | 2 files changed, 7 insertions(+), 5 deletions(-) | ||
30 | |||
31 | diff --git a/block/mirror.c b/block/mirror.c | ||
32 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
33 | --- a/block/mirror.c | 23 | --- a/hw/i386/sgx.c |
34 | +++ b/block/mirror.c | 24 | +++ b/hw/i386/sgx.c |
35 | @@ -XXX,XX +XXX,XX @@ static void coroutine_fn mirror_run(void *opaque) | 25 | @@ -XXX,XX +XXX,XX @@ void pc_machine_init_sgx_epc(PCMachineState *pcms) |
36 | } | ||
37 | |||
38 | ret = 0; | ||
39 | + | ||
40 | + if (s->synced && !should_complete) { | ||
41 | + delay_ns = (s->in_flight == 0 && cnt == 0 ? SLICE_TIME : 0); | ||
42 | + } | ||
43 | trace_mirror_before_sleep(s, cnt, s->synced, delay_ns); | ||
44 | + block_job_sleep_ns(&s->common, delay_ns); | ||
45 | if (block_job_is_cancelled(&s->common) && s->common.force) { | ||
46 | break; | ||
47 | - } else if (!should_complete) { | ||
48 | - delay_ns = (s->in_flight == 0 && cnt == 0 ? SLICE_TIME : 0); | ||
49 | - block_job_sleep_ns(&s->common, delay_ns); | ||
50 | } | ||
51 | s->last_pause_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); | ||
52 | } | 26 | } |
53 | diff --git a/tests/qemu-iotests/185.out b/tests/qemu-iotests/185.out | 27 | |
28 | if ((sgx_epc->base + sgx_epc->size) < sgx_epc->base) { | ||
29 | - error_report("Size of all 'sgx-epc' =0x%"PRIu64" causes EPC to wrap", | ||
30 | + error_report("Size of all 'sgx-epc' =0x%"PRIx64" causes EPC to wrap", | ||
31 | sgx_epc->size); | ||
32 | exit(EXIT_FAILURE); | ||
33 | } | ||
34 | diff --git a/hw/i386/trace-events b/hw/i386/trace-events | ||
54 | index XXXXXXX..XXXXXXX 100644 | 35 | index XXXXXXX..XXXXXXX 100644 |
55 | --- a/tests/qemu-iotests/185.out | 36 | --- a/hw/i386/trace-events |
56 | +++ b/tests/qemu-iotests/185.out | 37 | +++ b/hw/i386/trace-events |
57 | @@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 backing_file=TEST_DIR/t.q | 38 | @@ -XXX,XX +XXX,XX @@ vtd_fault_disabled(void) "Fault processing disabled for context entry" |
58 | {"return": {}} | 39 | vtd_replay_ce_valid(const char *mode, uint8_t bus, uint8_t dev, uint8_t fn, uint16_t domain, uint64_t hi, uint64_t lo) "%s: replay valid context device %02"PRIx8":%02"PRIx8".%02"PRIx8" domain 0x%"PRIx16" hi 0x%"PRIx64" lo 0x%"PRIx64 |
59 | Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 lazy_refcounts=off refcount_bits=16 | 40 | vtd_replay_ce_invalid(uint8_t bus, uint8_t dev, uint8_t fn) "replay invalid context device %02"PRIx8":%02"PRIx8".%02"PRIx8 |
60 | {"return": {}} | 41 | vtd_page_walk_level(uint64_t addr, uint32_t level, uint64_t start, uint64_t end) "walk (base=0x%"PRIx64", level=%"PRIu32") iova range 0x%"PRIx64" - 0x%"PRIx64 |
61 | +{"return": {}} | 42 | -vtd_page_walk_one(uint16_t domain, uint64_t iova, uint64_t gpa, uint64_t mask, int perm) "domain 0x%"PRIu16" iova 0x%"PRIx64" -> gpa 0x%"PRIx64" mask 0x%"PRIx64" perm %d" |
62 | +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} | 43 | +vtd_page_walk_one(uint16_t domain, uint64_t iova, uint64_t gpa, uint64_t mask, int perm) "domain 0x%"PRIx16" iova 0x%"PRIx64" -> gpa 0x%"PRIx64" mask 0x%"PRIx64" perm %d" |
63 | {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "mirror"}} | 44 | vtd_page_walk_one_skip_map(uint64_t iova, uint64_t mask, uint64_t translated) "iova 0x%"PRIx64" mask 0x%"PRIx64" translated 0x%"PRIx64 |
64 | -{"return": {}} | 45 | vtd_page_walk_one_skip_unmap(uint64_t iova, uint64_t mask) "iova 0x%"PRIx64" mask 0x%"PRIx64 |
65 | -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} | 46 | vtd_page_walk_skip_read(uint64_t iova, uint64_t next) "Page walk skip iova 0x%"PRIx64" - 0x%"PRIx64" due to unable to read" |
66 | {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "mirror"}} | 47 | vtd_page_walk_skip_reserve(uint64_t iova, uint64_t next) "Page walk skip iova 0x%"PRIx64" - 0x%"PRIx64" due to rsrv set" |
67 | 48 | vtd_switch_address_space(uint8_t bus, uint8_t slot, uint8_t fn, bool on) "Device %02x:%02x.%x switching address space (iommu enabled=%d)" | |
68 | === Start backup job and exit qemu === | 49 | vtd_as_unmap_whole(uint8_t bus, uint8_t slot, uint8_t fn, uint64_t iova, uint64_t size) "Device %02x:%02x.%x start 0x%"PRIx64" size 0x%"PRIx64 |
50 | -vtd_translate_pt(uint16_t sid, uint64_t addr) "source id 0x%"PRIu16", iova 0x%"PRIx64 | ||
51 | -vtd_pt_enable_fast_path(uint16_t sid, bool success) "sid 0x%"PRIu16" %d" | ||
52 | +vtd_translate_pt(uint16_t sid, uint64_t addr) "source id 0x%"PRIx16", iova 0x%"PRIx64 | ||
53 | +vtd_pt_enable_fast_path(uint16_t sid, bool success) "sid 0x%"PRIx16" %d" | ||
54 | vtd_irq_generate(uint64_t addr, uint64_t data) "addr 0x%"PRIx64" data 0x%"PRIx64 | ||
55 | vtd_reg_read(uint64_t addr, uint64_t size) "addr 0x%"PRIx64" size 0x%"PRIx64 | ||
56 | vtd_reg_write(uint64_t addr, uint64_t size, uint64_t val) "addr 0x%"PRIx64" size 0x%"PRIx64" value 0x%"PRIx64 | ||
57 | diff --git a/hw/misc/trace-events b/hw/misc/trace-events | ||
58 | index XXXXXXX..XXXXXXX 100644 | ||
59 | --- a/hw/misc/trace-events | ||
60 | +++ b/hw/misc/trace-events | ||
61 | @@ -XXX,XX +XXX,XX @@ | ||
62 | # See docs/devel/tracing.rst for syntax documentation. | ||
63 | |||
64 | # allwinner-cpucfg.c | ||
65 | -allwinner_cpucfg_cpu_reset(uint8_t cpu_id, uint32_t reset_addr) "id %u, reset_addr 0x%" PRIu32 | ||
66 | +allwinner_cpucfg_cpu_reset(uint8_t cpu_id, uint32_t reset_addr) "id %u, reset_addr 0x%" PRIx32 | ||
67 | allwinner_cpucfg_read(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 | ||
68 | allwinner_cpucfg_write(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 | ||
69 | |||
70 | @@ -XXX,XX +XXX,XX @@ imx7_gpr_write(uint64_t offset, uint64_t value) "addr 0x%08" PRIx64 "value 0x%08 | ||
71 | |||
72 | # mos6522.c | ||
73 | mos6522_set_counter(int index, unsigned int val) "T%d.counter=%d" | ||
74 | -mos6522_get_next_irq_time(uint16_t latch, int64_t d, int64_t delta) "latch=%d counter=0x%"PRId64 " delta_next=0x%"PRId64 | ||
75 | +mos6522_get_next_irq_time(uint16_t latch, int64_t d, int64_t delta) "latch=%d counter=0x%"PRIx64 " delta_next=0x%"PRIx64 | ||
76 | mos6522_set_sr_int(void) "set sr_int" | ||
77 | mos6522_write(uint64_t addr, const char *name, uint64_t val) "reg=0x%"PRIx64 " [%s] val=0x%"PRIx64 | ||
78 | mos6522_read(uint64_t addr, const char *name, unsigned val) "reg=0x%"PRIx64 " [%s] val=0x%x" | ||
79 | diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events | ||
80 | index XXXXXXX..XXXXXXX 100644 | ||
81 | --- a/hw/scsi/trace-events | ||
82 | +++ b/hw/scsi/trace-events | ||
83 | @@ -XXX,XX +XXX,XX @@ lsi_bad_phase_interrupt(void) "Phase mismatch interrupt" | ||
84 | lsi_bad_selection(uint32_t id) "Selected absent target %"PRIu32 | ||
85 | lsi_do_dma_unavailable(void) "DMA no data available" | ||
86 | lsi_do_dma(uint64_t addr, int len) "DMA addr=0x%"PRIx64" len=%d" | ||
87 | -lsi_queue_command(uint32_t tag) "Queueing tag=0x%"PRId32 | ||
88 | +lsi_queue_command(uint32_t tag) "Queueing tag=0x%"PRIx32 | ||
89 | lsi_add_msg_byte_error(void) "MSG IN data too long" | ||
90 | lsi_add_msg_byte(uint8_t data) "MSG IN 0x%02x" | ||
91 | lsi_reselect(int id) "Reselected target %d" | ||
92 | @@ -XXX,XX +XXX,XX @@ lsi_do_msgout_noop(void) "MSG: No Operation" | ||
93 | lsi_do_msgout_extended(uint8_t msg, uint8_t len) "Extended message 0x%x (len %d)" | ||
94 | lsi_do_msgout_ignored(const char *msg) "%s (ignored)" | ||
95 | lsi_do_msgout_simplequeue(uint8_t select_tag) "SIMPLE queue tag=0x%x" | ||
96 | -lsi_do_msgout_abort(uint32_t tag) "MSG: ABORT TAG tag=0x%"PRId32 | ||
97 | +lsi_do_msgout_abort(uint32_t tag) "MSG: ABORT TAG tag=0x%"PRIx32 | ||
98 | lsi_do_msgout_clearqueue(uint32_t tag) "MSG: CLEAR QUEUE tag=0x%"PRIx32 | ||
99 | lsi_do_msgout_busdevicereset(uint32_t tag) "MSG: BUS DEVICE RESET tag=0x%"PRIx32 | ||
100 | lsi_do_msgout_select(int id) "Select LUN %d" | ||
69 | -- | 101 | -- |
70 | 2.13.6 | 102 | 2.35.1 |
71 | 103 | ||
72 | 104 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Max Reitz <mreitz@redhat.com> | ||
2 | 1 | ||
3 | Commit b76e4458b1eb3c32e9824fe6aa51f67d2b251748 made the mirror block | ||
4 | job respect block-job-cancel's @force flag: With that flag set, it would | ||
5 | now always really cancel, even post-READY. | ||
6 | |||
7 | Unfortunately, it had a side effect: Without that flag set, it would now | ||
8 | never cancel, not even before READY. Considering that is an | ||
9 | incompatible change and not noted anywhere in the commit or the | ||
10 | description of block-job-cancel's @force parameter, this seems | ||
11 | unintentional and we should revert to the previous behavior, which is to | ||
12 | immediately cancel the job when block-job-cancel is called before source | ||
13 | and target are in sync (i.e. before the READY event). | ||
14 | |||
15 | Cc: qemu-stable@nongnu.org | ||
16 | Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1572856 | ||
17 | Reported-by: Yanan Fu <yfu@redhat.com> | ||
18 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
19 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
20 | Message-id: 20180501220509.14152-2-mreitz@redhat.com | ||
21 | Reviewed-by: Jeff Cody <jcody@redhat.com> | ||
22 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
23 | --- | ||
24 | block/mirror.c | 4 +++- | ||
25 | 1 file changed, 3 insertions(+), 1 deletion(-) | ||
26 | |||
27 | diff --git a/block/mirror.c b/block/mirror.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/block/mirror.c | ||
30 | +++ b/block/mirror.c | ||
31 | @@ -XXX,XX +XXX,XX @@ static void coroutine_fn mirror_run(void *opaque) | ||
32 | } | ||
33 | trace_mirror_before_sleep(s, cnt, s->synced, delay_ns); | ||
34 | block_job_sleep_ns(&s->common, delay_ns); | ||
35 | - if (block_job_is_cancelled(&s->common) && s->common.force) { | ||
36 | + if (block_job_is_cancelled(&s->common) && | ||
37 | + (!s->synced || s->common.force)) | ||
38 | + { | ||
39 | break; | ||
40 | } | ||
41 | s->last_pause_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); | ||
42 | -- | ||
43 | 2.13.6 | ||
44 | |||
45 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Max Reitz <mreitz@redhat.com> | ||
2 | 1 | ||
3 | We already have an extensive mirror test (041) which does cover | ||
4 | cancelling a mirror job, especially after it has emitted the READY | ||
5 | event. However, it does not check what exact events are emitted after | ||
6 | block-job-cancel is executed. More importantly, it does not use | ||
7 | throttling to ensure that it covers the case of block-job-cancel before | ||
8 | READY. | ||
9 | |||
10 | It would be possible to add this case to 041, but considering it is | ||
11 | already our largest test file, it makes sense to create a new file for | ||
12 | these cases. | ||
13 | |||
14 | Signed-off-by: Max Reitz <mreitz@redhat.com> | ||
15 | Message-id: 20180501220509.14152-3-mreitz@redhat.com | ||
16 | Signed-off-by: Jeff Cody <jcody@redhat.com> | ||
17 | --- | ||
18 | tests/qemu-iotests/218 | 138 +++++++++++++++++++++++++++++++++++++++++++++ | ||
19 | tests/qemu-iotests/218.out | 30 ++++++++++ | ||
20 | tests/qemu-iotests/group | 1 + | ||
21 | 3 files changed, 169 insertions(+) | ||
22 | create mode 100644 tests/qemu-iotests/218 | ||
23 | create mode 100644 tests/qemu-iotests/218.out | ||
24 | |||
25 | diff --git a/tests/qemu-iotests/218 b/tests/qemu-iotests/218 | ||
26 | new file mode 100644 | ||
27 | index XXXXXXX..XXXXXXX | ||
28 | --- /dev/null | ||
29 | +++ b/tests/qemu-iotests/218 | ||
30 | @@ -XXX,XX +XXX,XX @@ | ||
31 | +#!/usr/bin/env python | ||
32 | +# | ||
33 | +# This test covers what happens when a mirror block job is cancelled | ||
34 | +# in various phases of its existence. | ||
35 | +# | ||
36 | +# Note that this test only checks the emitted events (i.e. | ||
37 | +# BLOCK_JOB_COMPLETED vs. BLOCK_JOB_CANCELLED), it does not compare | ||
38 | +# whether the target is in sync with the source when the | ||
39 | +# BLOCK_JOB_COMPLETED event occurs. This is covered by other tests | ||
40 | +# (such as 041). | ||
41 | +# | ||
42 | +# Copyright (C) 2018 Red Hat, Inc. | ||
43 | +# | ||
44 | +# This program is free software; you can redistribute it and/or modify | ||
45 | +# it under the terms of the GNU General Public License as published by | ||
46 | +# the Free Software Foundation; either version 2 of the License, or | ||
47 | +# (at your option) any later version. | ||
48 | +# | ||
49 | +# This program is distributed in the hope that it will be useful, | ||
50 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
51 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
52 | +# GNU General Public License for more details. | ||
53 | +# | ||
54 | +# You should have received a copy of the GNU General Public License | ||
55 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
56 | +# | ||
57 | +# Creator/Owner: Max Reitz <mreitz@redhat.com> | ||
58 | + | ||
59 | +import iotests | ||
60 | +from iotests import log | ||
61 | + | ||
62 | +iotests.verify_platform(['linux']) | ||
63 | + | ||
64 | + | ||
65 | +# Launches the VM, adds two null-co nodes (source and target), and | ||
66 | +# starts a blockdev-mirror job on them. | ||
67 | +# | ||
68 | +# Either both or none of speed and buf_size must be given. | ||
69 | + | ||
70 | +def start_mirror(vm, speed=None, buf_size=None): | ||
71 | + vm.launch() | ||
72 | + | ||
73 | + ret = vm.qmp('blockdev-add', | ||
74 | + node_name='source', | ||
75 | + driver='null-co', | ||
76 | + size=1048576) | ||
77 | + assert ret['return'] == {} | ||
78 | + | ||
79 | + ret = vm.qmp('blockdev-add', | ||
80 | + node_name='target', | ||
81 | + driver='null-co', | ||
82 | + size=1048576) | ||
83 | + assert ret['return'] == {} | ||
84 | + | ||
85 | + if speed is not None: | ||
86 | + ret = vm.qmp('blockdev-mirror', | ||
87 | + job_id='mirror', | ||
88 | + device='source', | ||
89 | + target='target', | ||
90 | + sync='full', | ||
91 | + speed=speed, | ||
92 | + buf_size=buf_size) | ||
93 | + else: | ||
94 | + ret = vm.qmp('blockdev-mirror', | ||
95 | + job_id='mirror', | ||
96 | + device='source', | ||
97 | + target='target', | ||
98 | + sync='full') | ||
99 | + | ||
100 | + assert ret['return'] == {} | ||
101 | + | ||
102 | + | ||
103 | +log('') | ||
104 | +log('=== Cancel mirror job before convergence ===') | ||
105 | +log('') | ||
106 | + | ||
107 | +log('--- force=false ---') | ||
108 | +log('') | ||
109 | + | ||
110 | +with iotests.VM() as vm: | ||
111 | + # Low speed so it does not converge | ||
112 | + start_mirror(vm, 65536, 65536) | ||
113 | + | ||
114 | + log('Cancelling job') | ||
115 | + log(vm.qmp('block-job-cancel', device='mirror', force=False)) | ||
116 | + | ||
117 | + log(vm.event_wait('BLOCK_JOB_CANCELLED'), | ||
118 | + filters=[iotests.filter_qmp_event]) | ||
119 | + | ||
120 | +log('') | ||
121 | +log('--- force=true ---') | ||
122 | +log('') | ||
123 | + | ||
124 | +with iotests.VM() as vm: | ||
125 | + # Low speed so it does not converge | ||
126 | + start_mirror(vm, 65536, 65536) | ||
127 | + | ||
128 | + log('Cancelling job') | ||
129 | + log(vm.qmp('block-job-cancel', device='mirror', force=True)) | ||
130 | + | ||
131 | + log(vm.event_wait('BLOCK_JOB_CANCELLED'), | ||
132 | + filters=[iotests.filter_qmp_event]) | ||
133 | + | ||
134 | + | ||
135 | +log('') | ||
136 | +log('=== Cancel mirror job after convergence ===') | ||
137 | +log('') | ||
138 | + | ||
139 | +log('--- force=false ---') | ||
140 | +log('') | ||
141 | + | ||
142 | +with iotests.VM() as vm: | ||
143 | + start_mirror(vm) | ||
144 | + | ||
145 | + log(vm.event_wait('BLOCK_JOB_READY'), | ||
146 | + filters=[iotests.filter_qmp_event]) | ||
147 | + | ||
148 | + log('Cancelling job') | ||
149 | + log(vm.qmp('block-job-cancel', device='mirror', force=False)) | ||
150 | + | ||
151 | + log(vm.event_wait('BLOCK_JOB_COMPLETED'), | ||
152 | + filters=[iotests.filter_qmp_event]) | ||
153 | + | ||
154 | +log('') | ||
155 | +log('--- force=true ---') | ||
156 | +log('') | ||
157 | + | ||
158 | +with iotests.VM() as vm: | ||
159 | + start_mirror(vm) | ||
160 | + | ||
161 | + log(vm.event_wait('BLOCK_JOB_READY'), | ||
162 | + filters=[iotests.filter_qmp_event]) | ||
163 | + | ||
164 | + log('Cancelling job') | ||
165 | + log(vm.qmp('block-job-cancel', device='mirror', force=True)) | ||
166 | + | ||
167 | + log(vm.event_wait('BLOCK_JOB_CANCELLED'), | ||
168 | + filters=[iotests.filter_qmp_event]) | ||
169 | diff --git a/tests/qemu-iotests/218.out b/tests/qemu-iotests/218.out | ||
170 | new file mode 100644 | ||
171 | index XXXXXXX..XXXXXXX | ||
172 | --- /dev/null | ||
173 | +++ b/tests/qemu-iotests/218.out | ||
174 | @@ -XXX,XX +XXX,XX @@ | ||
175 | + | ||
176 | +=== Cancel mirror job before convergence === | ||
177 | + | ||
178 | +--- force=false --- | ||
179 | + | ||
180 | +Cancelling job | ||
181 | +{u'return': {}} | ||
182 | +{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u'device': u'mirror', u'type': u'mirror', u'speed': 65536, u'len': 1048576, u'offset': 65536}, u'event': u'BLOCK_JOB_CANCELLED'} | ||
183 | + | ||
184 | +--- force=true --- | ||
185 | + | ||
186 | +Cancelling job | ||
187 | +{u'return': {}} | ||
188 | +{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u'device': u'mirror', u'type': u'mirror', u'speed': 65536, u'len': 1048576, u'offset': 65536}, u'event': u'BLOCK_JOB_CANCELLED'} | ||
189 | + | ||
190 | +=== Cancel mirror job after convergence === | ||
191 | + | ||
192 | +--- force=false --- | ||
193 | + | ||
194 | +{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u'device': u'mirror', u'type': u'mirror', u'speed': 0, u'len': 1048576, u'offset': 1048576}, u'event': u'BLOCK_JOB_READY'} | ||
195 | +Cancelling job | ||
196 | +{u'return': {}} | ||
197 | +{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u'device': u'mirror', u'type': u'mirror', u'speed': 0, u'len': 1048576, u'offset': 1048576}, u'event': u'BLOCK_JOB_COMPLETED'} | ||
198 | + | ||
199 | +--- force=true --- | ||
200 | + | ||
201 | +{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u'device': u'mirror', u'type': u'mirror', u'speed': 0, u'len': 1048576, u'offset': 1048576}, u'event': u'BLOCK_JOB_READY'} | ||
202 | +Cancelling job | ||
203 | +{u'return': {}} | ||
204 | +{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u'device': u'mirror', u'type': u'mirror', u'speed': 0, u'len': 1048576, u'offset': 1048576}, u'event': u'BLOCK_JOB_CANCELLED'} | ||
205 | diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group | ||
206 | index XXXXXXX..XXXXXXX 100644 | ||
207 | --- a/tests/qemu-iotests/group | ||
208 | +++ b/tests/qemu-iotests/group | ||
209 | @@ -XXX,XX +XXX,XX @@ | ||
210 | 211 rw auto quick | ||
211 | 212 rw auto quick | ||
212 | 213 rw auto quick | ||
213 | +218 rw auto quick | ||
214 | -- | ||
215 | 2.13.6 | ||
216 | |||
217 | diff view generated by jsdifflib |