1
The following changes since commit ee135aa0428fe5af2af7be04ff16d2b596a9330a:
1
The following changes since commit ca61fa4b803e5d0abaf6f1ceb690f23bb78a4def:
2
2
3
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-3.1-20180821' into staging (2018-08-21 13:27:11 +0100)
3
Merge remote-tracking branch 'remotes/quic/tags/pull-hex-20211006' into staging (2021-10-06 12:11:14 -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/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 26bf474ba92c76e61bea51726e22da6dfd185296:
9
for you to fetch changes up to 1cc7eada97914f090125e588497986f6f7900514:
10
10
11
block: iotest to catch abort on forced blockjob cancel (2018-08-21 15:20:37 -0400)
11
iothread: use IOThreadParamInfo in iothread_[set|get]_param() (2021-10-07 15:29:50 +0100)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Block job patches
14
Pull request
15
15
----------------------------------------------------------------
16
----------------------------------------------------------------
16
17
17
Jeff Cody (2):
18
Stefano Garzarella (2):
18
block: for jobs, do not clear user_paused until after the resume
19
iothread: rename PollParamInfo to IOThreadParamInfo
19
block: iotest to catch abort on forced blockjob cancel
20
iothread: use IOThreadParamInfo in iothread_[set|get]_param()
20
21
21
job.c | 2 +-
22
iothread.c | 28 +++++++++++++++-------------
22
tests/qemu-iotests/229 | 95 ++++++++++++++++++++++++++++++++++++++
23
1 file changed, 15 insertions(+), 13 deletions(-)
23
tests/qemu-iotests/229.out | 23 +++++++++
24
tests/qemu-iotests/group | 1 +
25
4 files changed, 120 insertions(+), 1 deletion(-)
26
create mode 100755 tests/qemu-iotests/229
27
create mode 100644 tests/qemu-iotests/229.out
28
24
29
--
25
--
30
2.17.1
26
2.31.1
31
27
32
28
29
diff view generated by jsdifflib
1
Signed-off-by: Jeff Cody <jcody@redhat.com>
1
From: Stefano Garzarella <sgarzare@redhat.com>
2
Reviewed-by: John Snow <jsnow@redhat.com>
2
3
Message-id: df317f617fbe5affcf699cb8560e7b0c2e028a64.1534868459.git.jcody@redhat.com
3
Commit 1793ad0247 ("iothread: add aio-max-batch parameter") added
4
Signed-off-by: Jeff Cody <jcody@redhat.com>
4
a new parameter (aio-max-batch) to IOThread and used PollParamInfo
5
structure to handle it.
6
7
Since it is not a parameter of the polling mechanism, we rename the
8
structure to a more generic IOThreadParamInfo.
9
10
Suggested-by: Kevin Wolf <kwolf@redhat.com>
11
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
13
Message-id: 20210727145936.147032-2-sgarzare@redhat.com
14
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
5
---
15
---
6
tests/qemu-iotests/229 | 95 ++++++++++++++++++++++++++++++++++++++
16
iothread.c | 14 +++++++-------
7
tests/qemu-iotests/229.out | 23 +++++++++
17
1 file changed, 7 insertions(+), 7 deletions(-)
8
tests/qemu-iotests/group | 1 +
9
3 files changed, 119 insertions(+)
10
create mode 100755 tests/qemu-iotests/229
11
create mode 100644 tests/qemu-iotests/229.out
12
18
13
diff --git a/tests/qemu-iotests/229 b/tests/qemu-iotests/229
19
diff --git a/iothread.c b/iothread.c
14
new file mode 100755
15
index XXXXXXX..XXXXXXX
16
--- /dev/null
17
+++ b/tests/qemu-iotests/229
18
@@ -XXX,XX +XXX,XX @@
19
+#!/bin/bash
20
+#
21
+# Test for force canceling a running blockjob that is paused in
22
+# an error state.
23
+#
24
+# Copyright (C) 2018 Red Hat, Inc.
25
+#
26
+# This program is free software; you can redistribute it and/or modify
27
+# it under the terms of the GNU General Public License as published by
28
+# the Free Software Foundation; either version 2 of the License, or
29
+# (at your option) any later version.
30
+#
31
+# This program is distributed in the hope that it will be useful,
32
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
33
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34
+# GNU General Public License for more details.
35
+#
36
+# You should have received a copy of the GNU General Public License
37
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
38
+#
39
+
40
+# creator
41
+owner=jcody@redhat.com
42
+
43
+seq="$(basename $0)"
44
+echo "QA output created by $seq"
45
+
46
+here="$PWD"
47
+status=1    # failure is the default!
48
+
49
+_cleanup()
50
+{
51
+ _cleanup_qemu
52
+ _cleanup_test_img
53
+ rm -f "$TEST_IMG" "$DEST_IMG"
54
+}
55
+trap "_cleanup; exit \$status" 0 1 2 3 15
56
+
57
+# get standard environment, filters and checks
58
+. ./common.rc
59
+. ./common.filter
60
+. ./common.qemu
61
+
62
+# Needs backing file and backing format support
63
+_supported_fmt qcow2 qed
64
+_supported_proto file
65
+_supported_os Linux
66
+
67
+
68
+DEST_IMG="$TEST_DIR/d.$IMGFMT"
69
+TEST_IMG="$TEST_DIR/b.$IMGFMT"
70
+
71
+_make_test_img 2M
72
+
73
+# destination for mirror will be too small, causing error
74
+TEST_IMG=$DEST_IMG _make_test_img 1M
75
+
76
+$QEMU_IO -c 'write 0 2M' "$TEST_IMG" | _filter_qemu_io
77
+
78
+_launch_qemu -drive id=testdisk,file="$TEST_IMG",format="$IMGFMT"
79
+
80
+_send_qemu_cmd $QEMU_HANDLE \
81
+ "{'execute': 'qmp_capabilities'}" \
82
+ 'return'
83
+
84
+echo
85
+echo '=== Starting drive-mirror, causing error & stop ==='
86
+echo
87
+
88
+_send_qemu_cmd $QEMU_HANDLE \
89
+ "{'execute': 'drive-mirror',
90
+ 'arguments': {'device': 'testdisk',
91
+ 'mode': 'absolute-paths',
92
+ 'format': '$IMGFMT',
93
+ 'target': '$DEST_IMG',
94
+ 'sync': 'full',
95
+ 'mode': 'existing',
96
+ 'on-source-error': 'stop',
97
+ 'on-target-error': 'stop' }}" \
98
+ "JOB_STATUS_CHANGE.*pause"
99
+
100
+echo
101
+echo '=== Force cancel job paused in error state ==='
102
+echo
103
+
104
+success_or_failure="y" _send_qemu_cmd $QEMU_HANDLE \
105
+ "{'execute': 'block-job-cancel',
106
+ 'arguments': { 'device': 'testdisk',
107
+ 'force': true}}" \
108
+ "BLOCK_JOB_CANCELLED" "Assertion"
109
+
110
+# success, all done
111
+echo "*** done"
112
+rm -f $seq.full
113
+status=0
114
diff --git a/tests/qemu-iotests/229.out b/tests/qemu-iotests/229.out
115
new file mode 100644
116
index XXXXXXX..XXXXXXX
117
--- /dev/null
118
+++ b/tests/qemu-iotests/229.out
119
@@ -XXX,XX +XXX,XX @@
120
+QA output created by 229
121
+Formatting 'TEST_DIR/b.IMGFMT', fmt=IMGFMT size=2097152
122
+Formatting 'TEST_DIR/d.IMGFMT', fmt=IMGFMT size=1048576
123
+wrote 2097152/2097152 bytes at offset 0
124
+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
125
+{"return": {}}
126
+
127
+=== Starting drive-mirror, causing error & stop ===
128
+
129
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "testdisk"}}
130
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "testdisk"}}
131
+{"return": {}}
132
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "testdisk", "operation": "write", "action": "stop"}}
133
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "paused", "id": "testdisk"}}
134
+
135
+=== Force cancel job paused in error state ===
136
+
137
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "testdisk"}}
138
+{"return": {}}
139
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "testdisk", "operation": "write", "action": "stop"}}
140
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "aborting", "id": "testdisk"}}
141
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "testdisk", "len": 2097152, "offset": 1048576, "speed": 0, "type": "mirror"}}
142
+*** done
143
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
144
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
145
--- a/tests/qemu-iotests/group
21
--- a/iothread.c
146
+++ b/tests/qemu-iotests/group
22
+++ b/iothread.c
147
@@ -XXX,XX +XXX,XX @@
23
@@ -XXX,XX +XXX,XX @@ static void iothread_complete(UserCreatable *obj, Error **errp)
148
225 rw auto quick
24
typedef struct {
149
226 auto quick
25
const char *name;
150
227 auto quick
26
ptrdiff_t offset; /* field's byte offset in IOThread struct */
151
+229 auto quick
27
-} PollParamInfo;
28
+} IOThreadParamInfo;
29
30
-static PollParamInfo poll_max_ns_info = {
31
+static IOThreadParamInfo poll_max_ns_info = {
32
"poll-max-ns", offsetof(IOThread, poll_max_ns),
33
};
34
-static PollParamInfo poll_grow_info = {
35
+static IOThreadParamInfo poll_grow_info = {
36
"poll-grow", offsetof(IOThread, poll_grow),
37
};
38
-static PollParamInfo poll_shrink_info = {
39
+static IOThreadParamInfo poll_shrink_info = {
40
"poll-shrink", offsetof(IOThread, poll_shrink),
41
};
42
-static PollParamInfo aio_max_batch_info = {
43
+static IOThreadParamInfo aio_max_batch_info = {
44
"aio-max-batch", offsetof(IOThread, aio_max_batch),
45
};
46
47
@@ -XXX,XX +XXX,XX @@ static void iothread_get_param(Object *obj, Visitor *v,
48
const char *name, void *opaque, Error **errp)
49
{
50
IOThread *iothread = IOTHREAD(obj);
51
- PollParamInfo *info = opaque;
52
+ IOThreadParamInfo *info = opaque;
53
int64_t *field = (void *)iothread + info->offset;
54
55
visit_type_int64(v, name, field, errp);
56
@@ -XXX,XX +XXX,XX @@ static bool iothread_set_param(Object *obj, Visitor *v,
57
const char *name, void *opaque, Error **errp)
58
{
59
IOThread *iothread = IOTHREAD(obj);
60
- PollParamInfo *info = opaque;
61
+ IOThreadParamInfo *info = opaque;
62
int64_t *field = (void *)iothread + info->offset;
63
int64_t value;
64
152
--
65
--
153
2.17.1
66
2.31.1
154
67
155
68
diff view generated by jsdifflib
1
The function job_cancel_async() will always cause an assert for blockjob
1
From: Stefano Garzarella <sgarzare@redhat.com>
2
user resume. We set job->user_paused to false, and then call
3
job->driver->user_resume(). In the case of blockjobs, this is the
4
block_job_user_resume() function.
5
2
6
In that function, we assert that job.user_paused is set to true.
3
Commit 0445409d74 ("iothread: generalize
7
Unfortunately, right before calling this function, it has explicitly
4
iothread_set_param/iothread_get_param") moved common code to set and
8
been set to false.
5
get IOThread parameters in two new functions.
9
6
10
The fix is pretty simple: set job->user_paused to false only after the
7
These functions are called inside callbacks, so we don't need to use an
11
job user_resume() function has been called.
8
opaque pointer. Let's replace `void *opaque` parameter with
9
`IOThreadParamInfo *info`.
12
10
13
Reviewed-by: John Snow <jsnow@redhat.com>
11
Suggested-by: Kevin Wolf <kwolf@redhat.com>
14
Reviewed-by: Eric Blake <eblake@redhat.com>
12
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
15
Signed-off-by: Jeff Cody <jcody@redhat.com>
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
16
Message-id: bb183b77d8f2dd6bd67b8da559a90ac1e74b2052.1534868459.git.jcody@redhat.com
14
Message-id: 20210727145936.147032-3-sgarzare@redhat.com
17
Signed-off-by: Jeff Cody <jcody@redhat.com>
15
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
18
---
16
---
19
job.c | 2 +-
17
iothread.c | 18 ++++++++++--------
20
1 file changed, 1 insertion(+), 1 deletion(-)
18
1 file changed, 10 insertions(+), 8 deletions(-)
21
19
22
diff --git a/job.c b/job.c
20
diff --git a/iothread.c b/iothread.c
23
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
24
--- a/job.c
22
--- a/iothread.c
25
+++ b/job.c
23
+++ b/iothread.c
26
@@ -XXX,XX +XXX,XX @@ static void job_cancel_async(Job *job, bool force)
24
@@ -XXX,XX +XXX,XX @@ static IOThreadParamInfo aio_max_batch_info = {
25
};
26
27
static void iothread_get_param(Object *obj, Visitor *v,
28
- const char *name, void *opaque, Error **errp)
29
+ const char *name, IOThreadParamInfo *info, Error **errp)
27
{
30
{
28
if (job->user_paused) {
31
IOThread *iothread = IOTHREAD(obj);
29
/* Do not call job_enter here, the caller will handle it. */
32
- IOThreadParamInfo *info = opaque;
30
- job->user_paused = false;
33
int64_t *field = (void *)iothread + info->offset;
31
if (job->driver->user_resume) {
34
32
job->driver->user_resume(job);
35
visit_type_int64(v, name, field, errp);
33
}
36
}
34
+ job->user_paused = false;
37
35
assert(job->pause_count > 0);
38
static bool iothread_set_param(Object *obj, Visitor *v,
36
job->pause_count--;
39
- const char *name, void *opaque, Error **errp)
40
+ const char *name, IOThreadParamInfo *info, Error **errp)
41
{
42
IOThread *iothread = IOTHREAD(obj);
43
- IOThreadParamInfo *info = opaque;
44
int64_t *field = (void *)iothread + info->offset;
45
int64_t value;
46
47
@@ -XXX,XX +XXX,XX @@ static bool iothread_set_param(Object *obj, Visitor *v,
48
static void iothread_get_poll_param(Object *obj, Visitor *v,
49
const char *name, void *opaque, Error **errp)
50
{
51
+ IOThreadParamInfo *info = opaque;
52
53
- iothread_get_param(obj, v, name, opaque, errp);
54
+ iothread_get_param(obj, v, name, info, errp);
55
}
56
57
static void iothread_set_poll_param(Object *obj, Visitor *v,
58
const char *name, void *opaque, Error **errp)
59
{
60
IOThread *iothread = IOTHREAD(obj);
61
+ IOThreadParamInfo *info = opaque;
62
63
- if (!iothread_set_param(obj, v, name, opaque, errp)) {
64
+ if (!iothread_set_param(obj, v, name, info, errp)) {
65
return;
37
}
66
}
67
68
@@ -XXX,XX +XXX,XX @@ static void iothread_set_poll_param(Object *obj, Visitor *v,
69
static void iothread_get_aio_param(Object *obj, Visitor *v,
70
const char *name, void *opaque, Error **errp)
71
{
72
+ IOThreadParamInfo *info = opaque;
73
74
- iothread_get_param(obj, v, name, opaque, errp);
75
+ iothread_get_param(obj, v, name, info, errp);
76
}
77
78
static void iothread_set_aio_param(Object *obj, Visitor *v,
79
const char *name, void *opaque, Error **errp)
80
{
81
IOThread *iothread = IOTHREAD(obj);
82
+ IOThreadParamInfo *info = opaque;
83
84
- if (!iothread_set_param(obj, v, name, opaque, errp)) {
85
+ if (!iothread_set_param(obj, v, name, info, errp)) {
86
return;
87
}
88
38
--
89
--
39
2.17.1
90
2.31.1
40
91
41
92
diff view generated by jsdifflib