1
The following changes since commit 0280396a33c7210c4df5306afeab63411a41535a:
1
The following changes since commit 86f4c7e05b1c44dbe1b329a51f311f10aef6ff34:
2
2
3
Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-gdbstub-150221-1' into staging (2021-02-15 10:13:13 +0000)
3
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180302' into staging (2018-03-02 14:37:10 +0000)
4
4
5
are available in the Git repository at:
5
are available in the git repository at:
6
6
7
git://repo.or.cz/qemu/kevin.git tags/for-upstream
7
git://repo.or.cz/qemu/kevin.git tags/for-upstream
8
8
9
for you to fetch changes up to b248e61652e20c3353af4b0ccb90f17d76f4db21:
9
for you to fetch changes up to bfe1a14c180ec44c033be12b9151252ffda69292:
10
10
11
monitor/qmp: Stop processing requests when shutdown is requested (2021-02-15 15:10:14 +0100)
11
block: Fix NULL dereference on empty drive error (2018-03-05 18:45:32 +0100)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Block layer patches:
14
Block layer patches
15
16
- qemu-storage-daemon: Enable object-add
17
- blockjob: Fix crash with IOthread when block commit after snapshot
18
- monitor: Shutdown fixes
19
- xen-block: fix reporting of discard feature
20
- qcow2: Remove half-initialised image file after failed image creation
21
- ahci: Fix DMA direction
22
- iotests fixes
23
15
24
----------------------------------------------------------------
16
----------------------------------------------------------------
25
Alexander Bulekov (1):
17
Alberto Garcia (3):
26
hw/ide/ahci: map cmd_fis as DMA_DIRECTION_TO_DEVICE
18
specs/qcow2: Fix documentation of the compressed cluster descriptor
19
docs: document how to use the l2-cache-entry-size parameter
20
qcow2: Replace align_offset() with ROUND_UP()
21
22
Anton Nefedov (2):
23
block: fix write with zero flag set and iovector provided
24
iotest 033: add misaligned write-zeroes test via truncate
25
26
Eric Blake (21):
27
block: Add .bdrv_co_block_status() callback
28
nvme: Drop pointless .bdrv_co_get_block_status()
29
block: Switch passthrough drivers to .bdrv_co_block_status()
30
file-posix: Switch to .bdrv_co_block_status()
31
gluster: Switch to .bdrv_co_block_status()
32
iscsi: Switch cluster_sectors to byte-based
33
iscsi: Switch iscsi_allocmap_update() to byte-based
34
iscsi: Switch to .bdrv_co_block_status()
35
null: Switch to .bdrv_co_block_status()
36
parallels: Switch to .bdrv_co_block_status()
37
qcow: Switch to .bdrv_co_block_status()
38
qcow2: Switch to .bdrv_co_block_status()
39
qed: Switch to .bdrv_co_block_status()
40
raw: Switch to .bdrv_co_block_status()
41
sheepdog: Switch to .bdrv_co_block_status()
42
vdi: Avoid bitrot of debugging code
43
vdi: Switch to .bdrv_co_block_status()
44
vmdk: Switch to .bdrv_co_block_status()
45
vpc: Switch to .bdrv_co_block_status()
46
vvfat: Switch to .bdrv_co_block_status()
47
block: Drop unused .bdrv_co_get_block_status()
27
48
28
Kevin Wolf (3):
49
Kevin Wolf (3):
29
qemu-storage-daemon: Enable object-add
50
block: test blk_aio_flush() with blk->root == NULL
30
monitor: Fix assertion failure on shutdown
51
Merge remote-tracking branch 'mreitz/tags/pull-block-2018-03-02' into queue-block
31
monitor/qmp: Stop processing requests when shutdown is requested
52
block: Fix NULL dereference on empty drive error
32
53
33
Max Reitz (1):
54
Max Reitz (4):
34
iotests: Consistent $IMGOPTS boundary matching
55
qemu-img: Make resize error message more general
56
block/ssh: Pull ssh_grow_file() from ssh_create()
57
block/ssh: Make ssh_grow_file() blocking
58
block/ssh: Add basic .bdrv_truncate()
35
59
36
Maxim Levitsky (3):
60
Stefan Hajnoczi (6):
37
crypto: luks: Fix tiny memory leak
61
aio: rename aio_context_in_iothread() to in_aio_context_home_thread()
38
block: add bdrv_co_delete_file_noerr
62
block: extract AIO_WAIT_WHILE() from BlockDriverState
39
block: qcow2: remove the created file on initialization error
63
block: add BlockBackend->in_flight counter
64
Revert "IDE: Do not flush empty CDROM drives"
65
block: rename .bdrv_create() to .bdrv_co_create_opts()
66
qcow2: make qcow2_co_create2() a coroutine_fn
40
67
41
Michael Qiu (1):
68
qapi/block-core.json | 6 +-
42
blockjob: Fix crash with IOthread when block commit after snapshot
69
docs/interop/qcow2.txt | 16 ++++-
70
docs/qcow2-cache.txt | 46 ++++++++++++-
71
block/qcow2.h | 6 --
72
include/block/aio-wait.h | 116 ++++++++++++++++++++++++++++++++
73
include/block/aio.h | 7 +-
74
include/block/block.h | 54 ++++-----------
75
include/block/block_int.h | 61 ++++++++++-------
76
block.c | 11 ++-
77
block/blkdebug.c | 20 +++---
78
block/block-backend.c | 65 +++++++++++++++---
79
block/commit.c | 2 +-
80
block/crypto.c | 8 +--
81
block/file-posix.c | 79 +++++++++++-----------
82
block/file-win32.c | 5 +-
83
block/gluster.c | 83 ++++++++++++-----------
84
block/io.c | 98 +++++++++++----------------
85
block/iscsi.c | 164 ++++++++++++++++++++++++---------------------
86
block/mirror.c | 2 +-
87
block/nfs.c | 5 +-
88
block/null.c | 23 ++++---
89
block/nvme.c | 14 ----
90
block/parallels.c | 28 +++++---
91
block/qcow.c | 32 +++++----
92
block/qcow2-bitmap.c | 4 +-
93
block/qcow2-cluster.c | 4 +-
94
block/qcow2-refcount.c | 4 +-
95
block/qcow2-snapshot.c | 10 +--
96
block/qcow2.c | 60 +++++++++--------
97
block/qed.c | 82 ++++++++---------------
98
block/raw-format.c | 21 +++---
99
block/rbd.c | 6 +-
100
block/sheepdog.c | 36 +++++-----
101
block/ssh.c | 66 +++++++++++++++---
102
block/throttle.c | 2 +-
103
block/vdi.c | 50 +++++++-------
104
block/vhdx.c | 5 +-
105
block/vmdk.c | 43 +++++-------
106
block/vpc.c | 50 +++++++-------
107
block/vvfat.c | 16 ++---
108
hw/ide/core.c | 10 +--
109
qemu-img.c | 2 +-
110
tests/test-block-backend.c | 82 +++++++++++++++++++++++
111
util/aio-wait.c | 40 +++++++++++
112
tests/Makefile.include | 2 +
113
tests/qemu-iotests/033 | 29 ++++++++
114
tests/qemu-iotests/033.out | 13 ++++
115
util/Makefile.objs | 2 +-
116
48 files changed, 980 insertions(+), 610 deletions(-)
117
create mode 100644 include/block/aio-wait.h
118
create mode 100644 tests/test-block-backend.c
119
create mode 100644 util/aio-wait.c
43
120
44
Roger Pau Monné (1):
45
xen-block: fix reporting of discard feature
46
47
Thomas Huth (1):
48
tests/qemu-iotests: Remove test 259 from the "auto" group
49
50
include/block/block.h | 1 +
51
block.c | 22 ++++++++++++++++++++++
52
block/crypto.c | 13 ++-----------
53
block/qcow2.c | 8 +++++---
54
blockjob.c | 8 ++++++--
55
hw/block/xen-block.c | 1 +
56
hw/ide/ahci.c | 12 ++++++------
57
monitor/monitor.c | 25 +++++++++++++++----------
58
monitor/qmp.c | 5 +++++
59
storage-daemon/qemu-storage-daemon.c | 2 ++
60
tests/qemu-iotests/259 | 2 +-
61
tests/qemu-iotests/common.rc | 4 +++-
62
12 files changed, 69 insertions(+), 34 deletions(-)
63
64
diff view generated by jsdifflib
Deleted patch
1
As we don't have a fully QAPIfied version of object-add yet and it still
2
has 'gen': false in the schema, it needs to be registered explicitly in
3
init_qmp_commands() to be available for users.
4
1
5
Fixes: 2af282ec51a27116d0402cab237b8970800f870c
6
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7
Message-Id: <20210204072137.19663-1-kwolf@redhat.com>
8
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10
---
11
storage-daemon/qemu-storage-daemon.c | 2 ++
12
1 file changed, 2 insertions(+)
13
14
diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-storage-daemon.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/storage-daemon/qemu-storage-daemon.c
17
+++ b/storage-daemon/qemu-storage-daemon.c
18
@@ -XXX,XX +XXX,XX @@ static void init_qmp_commands(void)
19
qmp_init_marshal(&qmp_commands);
20
qmp_register_command(&qmp_commands, "query-qmp-schema",
21
qmp_query_qmp_schema, QCO_ALLOW_PRECONFIG);
22
+ qmp_register_command(&qmp_commands, "object-add", qmp_object_add,
23
+ QCO_NO_OPTIONS);
24
25
QTAILQ_INIT(&qmp_cap_negotiation_commands);
26
qmp_register_command(&qmp_cap_negotiation_commands, "qmp_capabilities",
27
--
28
2.29.2
29
30
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
To disallow certain refcount_bits values, some _unsupported_imgopts
4
invocations look like "refcount_bits=1[^0-9]", i.e. they match an
5
integer boundary with [^0-9]. This expression does not match the end of
6
the string, though, so it breaks down when refcount_bits is the last
7
option (which it tends to be after the rewrite of the check script in
8
Python).
9
10
Those invocations could use \b or \> instead, but those are not
11
portable. They could use something like \([^0-9]\|$\), but that would
12
be cumbersome. To make it simple and keep the existing invocations
13
working, just let _unsupported_imgopts match the regex against $IMGOPTS
14
plus a trailing space.
15
16
Suggested-by: Eric Blake <eblake@redhat.com>
17
Signed-off-by: Max Reitz <mreitz@redhat.com>
18
Message-Id: <20210210095128.22732-1-mreitz@redhat.com>
19
Reviewed-by: Eric Blake <eblake@redhat.com>
20
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
21
---
22
tests/qemu-iotests/common.rc | 4 +++-
23
1 file changed, 3 insertions(+), 1 deletion(-)
24
25
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
26
index XXXXXXX..XXXXXXX 100644
27
--- a/tests/qemu-iotests/common.rc
28
+++ b/tests/qemu-iotests/common.rc
29
@@ -XXX,XX +XXX,XX @@ _unsupported_imgopts()
30
{
31
for bad_opt
32
do
33
- if echo "$IMGOPTS" | grep -q 2>/dev/null "$bad_opt"
34
+ # Add a space so tests can match for whitespace that marks the
35
+ # end of an option (\b or \> are not portable)
36
+ if echo "$IMGOPTS " | grep -q 2>/dev/null "$bad_opt"
37
then
38
_notrun "not suitable for image option: $bad_opt"
39
fi
40
--
41
2.29.2
42
43
diff view generated by jsdifflib
Deleted patch
1
From: Michael Qiu <qiudayu@huayun.com>
2
1
3
Currently, if guest has workloads, IO thread will acquire aio_context
4
lock before do io_submit, it leads to segmentfault when do block commit
5
after snapshot. Just like below:
6
7
Program received signal SIGSEGV, Segmentation fault.
8
9
[Switching to Thread 0x7f7c7d91f700 (LWP 99907)]
10
0x00005576d0f65aab in bdrv_mirror_top_pwritev at ../block/mirror.c:1437
11
1437 ../block/mirror.c: No such file or directory.
12
(gdb) p s->job
13
$17 = (MirrorBlockJob *) 0x0
14
(gdb) p s->stop
15
$18 = false
16
17
Call trace of IO thread:
18
0 0x00005576d0f65aab in bdrv_mirror_top_pwritev at ../block/mirror.c:1437
19
1 0x00005576d0f7f3ab in bdrv_driver_pwritev at ../block/io.c:1174
20
2 0x00005576d0f8139d in bdrv_aligned_pwritev at ../block/io.c:1988
21
3 0x00005576d0f81b65 in bdrv_co_pwritev_part at ../block/io.c:2156
22
4 0x00005576d0f8e6b7 in blk_do_pwritev_part at ../block/block-backend.c:1260
23
5 0x00005576d0f8e84d in blk_aio_write_entry at ../block/block-backend.c:1476
24
...
25
26
Switch to qemu main thread:
27
0 0x00007f903be704ed in __lll_lock_wait at
28
/lib/../lib64/libpthread.so.0
29
1 0x00007f903be6bde6 in _L_lock_941 at /lib/../lib64/libpthread.so.0
30
2 0x00007f903be6bcdf in pthread_mutex_lock at
31
/lib/../lib64/libpthread.so.0
32
3 0x0000564b21456889 in qemu_mutex_lock_impl at
33
../util/qemu-thread-posix.c:79
34
4 0x0000564b213af8a5 in block_job_add_bdrv at ../blockjob.c:224
35
5 0x0000564b213b00ad in block_job_create at ../blockjob.c:440
36
6 0x0000564b21357c0a in mirror_start_job at ../block/mirror.c:1622
37
7 0x0000564b2135a9af in commit_active_start at ../block/mirror.c:1867
38
8 0x0000564b2133d132 in qmp_block_commit at ../blockdev.c:2768
39
9 0x0000564b2141fef3 in qmp_marshal_block_commit at
40
qapi/qapi-commands-block-core.c:346
41
10 0x0000564b214503c9 in do_qmp_dispatch_bh at
42
../qapi/qmp-dispatch.c:110
43
11 0x0000564b21451996 in aio_bh_poll at ../util/async.c:164
44
12 0x0000564b2146018e in aio_dispatch at ../util/aio-posix.c:381
45
13 0x0000564b2145187e in aio_ctx_dispatch at ../util/async.c:306
46
14 0x00007f9040239049 in g_main_context_dispatch at
47
/lib/../lib64/libglib-2.0.so.0
48
15 0x0000564b21447368 in main_loop_wait at ../util/main-loop.c:232
49
16 0x0000564b21447368 in main_loop_wait at ../util/main-loop.c:255
50
17 0x0000564b21447368 in main_loop_wait at ../util/main-loop.c:531
51
18 0x0000564b212304e1 in qemu_main_loop at ../softmmu/runstate.c:721
52
19 0x0000564b20f7975e in main at ../softmmu/main.c:50
53
54
In IO thread when do bdrv_mirror_top_pwritev, the job is NULL, and stop field
55
is false, this means the MirrorBDSOpaque "s" object has not been initialized
56
yet, and this object is initialized by block_job_create(), but the initialize
57
process is stuck in acquiring the lock.
58
59
In this situation, IO thread come to bdrv_mirror_top_pwritev(),which means that
60
mirror-top node is already inserted into block graph, but its bs->opaque->job
61
is not initialized.
62
63
The root cause is that qemu main thread do release/acquire when hold the lock,
64
at the same time, IO thread get the lock after release stage, and the crash
65
occured.
66
67
Actually, in this situation, job->job.aio_context will not equal to
68
qemu_get_aio_context(), and will be the same as bs->aio_context,
69
thus, no need to release the lock, becasue bdrv_root_attach_child()
70
will not change the context.
71
72
This patch fix this issue.
73
74
Fixes: 132ada80 "block: Adjust AioContexts when attaching nodes"
75
76
Signed-off-by: Michael Qiu <qiudayu@huayun.com>
77
Message-Id: <20210203024059.52683-1-08005325@163.com>
78
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
79
---
80
blockjob.c | 8 ++++++--
81
1 file changed, 6 insertions(+), 2 deletions(-)
82
83
diff --git a/blockjob.c b/blockjob.c
84
index XXXXXXX..XXXXXXX 100644
85
--- a/blockjob.c
86
+++ b/blockjob.c
87
@@ -XXX,XX +XXX,XX @@ int block_job_add_bdrv(BlockJob *job, const char *name, BlockDriverState *bs,
88
uint64_t perm, uint64_t shared_perm, Error **errp)
89
{
90
BdrvChild *c;
91
+ bool need_context_ops;
92
93
bdrv_ref(bs);
94
- if (job->job.aio_context != qemu_get_aio_context()) {
95
+
96
+ need_context_ops = bdrv_get_aio_context(bs) != job->job.aio_context;
97
+
98
+ if (need_context_ops && job->job.aio_context != qemu_get_aio_context()) {
99
aio_context_release(job->job.aio_context);
100
}
101
c = bdrv_root_attach_child(bs, name, &child_job, 0,
102
job->job.aio_context, perm, shared_perm, job,
103
errp);
104
- if (job->job.aio_context != qemu_get_aio_context()) {
105
+ if (need_context_ops && job->job.aio_context != qemu_get_aio_context()) {
106
aio_context_acquire(job->job.aio_context);
107
}
108
if (c == NULL) {
109
--
110
2.29.2
111
112
diff view generated by jsdifflib
Deleted patch
1
From: Alexander Bulekov <alxndr@bu.edu>
2
1
3
cmd_fis is mapped as DMA_DIRECTION_FROM_DEVICE, however, it is read
4
from, and not written to anywhere. Fix the DMA_DIRECTION and mark
5
cmd_fis as read-only in the code.
6
7
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
8
Message-Id: <20210119164051.89268-1-alxndr@bu.edu>
9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10
---
11
hw/ide/ahci.c | 12 ++++++------
12
1 file changed, 6 insertions(+), 6 deletions(-)
13
14
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/ide/ahci.c
17
+++ b/hw/ide/ahci.c
18
@@ -XXX,XX +XXX,XX @@ static void ahci_reset_port(AHCIState *s, int port)
19
}
20
21
/* Buffer pretty output based on a raw FIS structure. */
22
-static char *ahci_pretty_buffer_fis(uint8_t *fis, int cmd_len)
23
+static char *ahci_pretty_buffer_fis(const uint8_t *fis, int cmd_len)
24
{
25
int i;
26
GString *s = g_string_new("FIS:");
27
@@ -XXX,XX +XXX,XX @@ static void execute_ncq_command(NCQTransferState *ncq_tfs)
28
}
29
30
31
-static void process_ncq_command(AHCIState *s, int port, uint8_t *cmd_fis,
32
+static void process_ncq_command(AHCIState *s, int port, const uint8_t *cmd_fis,
33
uint8_t slot)
34
{
35
AHCIDevice *ad = &s->dev[port];
36
- NCQFrame *ncq_fis = (NCQFrame*)cmd_fis;
37
+ const NCQFrame *ncq_fis = (NCQFrame *)cmd_fis;
38
uint8_t tag = ncq_fis->tag >> 3;
39
NCQTransferState *ncq_tfs = &ad->ncq_tfs[tag];
40
size_t size;
41
@@ -XXX,XX +XXX,XX @@ static AHCICmdHdr *get_cmd_header(AHCIState *s, uint8_t port, uint8_t slot)
42
}
43
44
static void handle_reg_h2d_fis(AHCIState *s, int port,
45
- uint8_t slot, uint8_t *cmd_fis)
46
+ uint8_t slot, const uint8_t *cmd_fis)
47
{
48
IDEState *ide_state = &s->dev[port].port.ifs[0];
49
AHCICmdHdr *cmd = get_cmd_header(s, port, slot);
50
@@ -XXX,XX +XXX,XX @@ static int handle_cmd(AHCIState *s, int port, uint8_t slot)
51
tbl_addr = le64_to_cpu(cmd->tbl_addr);
52
cmd_len = 0x80;
53
cmd_fis = dma_memory_map(s->as, tbl_addr, &cmd_len,
54
- DMA_DIRECTION_FROM_DEVICE);
55
+ DMA_DIRECTION_TO_DEVICE);
56
if (!cmd_fis) {
57
trace_handle_cmd_badfis(s, port);
58
return -1;
59
@@ -XXX,XX +XXX,XX @@ static int handle_cmd(AHCIState *s, int port, uint8_t slot)
60
}
61
62
out:
63
- dma_memory_unmap(s->as, cmd_fis, cmd_len, DMA_DIRECTION_FROM_DEVICE,
64
+ dma_memory_unmap(s->as, cmd_fis, cmd_len, DMA_DIRECTION_TO_DEVICE,
65
cmd_len);
66
67
if (s->dev[port].port.ifs[0].status & (BUSY_STAT|DRQ_STAT)) {
68
--
69
2.29.2
70
71
diff view generated by jsdifflib
Deleted patch
1
From: Roger Pau Monne <roger.pau@citrix.com>
2
1
3
Linux blkfront expects both "discard-granularity" and
4
"discard-alignment" present on xenbus in order to properly enable the
5
feature, not exposing "discard-alignment" left some Linux blkfront
6
versions with a broken discard setup. This has also been addressed in
7
Linux with:
8
9
https://lore.kernel.org/lkml/20210118151528.81668-1-roger.pau@citrix.com/T/#u
10
11
Fix QEMU to report a "discard-alignment" of 0, in order for it to work
12
with older Linux frontends.
13
14
Reported-by: Arthur Borsboom <arthurborsboom@gmail.com>
15
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
16
Message-Id: <20210118153330.82324-1-roger.pau@citrix.com>
17
Reviewed-by: Paul Durrant <paul@xen.org>
18
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
19
---
20
hw/block/xen-block.c | 1 +
21
1 file changed, 1 insertion(+)
22
23
diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c
24
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/block/xen-block.c
26
+++ b/hw/block/xen-block.c
27
@@ -XXX,XX +XXX,XX @@ static void xen_block_realize(XenDevice *xendev, Error **errp)
28
xen_device_backend_printf(xendev, "feature-discard", "%u", 1);
29
xen_device_backend_printf(xendev, "discard-granularity", "%u",
30
conf->discard_granularity);
31
+ xen_device_backend_printf(xendev, "discard-alignment", "%u", 0);
32
}
33
34
xen_device_backend_printf(xendev, "feature-flush-cache", "%u", 1);
35
--
36
2.29.2
37
38
diff view generated by jsdifflib
Deleted patch
1
From: Thomas Huth <thuth@redhat.com>
2
1
3
Tests in the "auto" group should support qcow2 so that they can
4
be run during "make check-block". Test 259 only supports "raw", so
5
it currently always gets skipped when running "make check-block".
6
Let's skip this unnecessary step and remove it from the auto group.
7
8
Signed-off-by: Thomas Huth <thuth@redhat.com>
9
Message-Id: <20210215103835.1129145-1-thuth@redhat.com>
10
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11
---
12
tests/qemu-iotests/259 | 2 +-
13
1 file changed, 1 insertion(+), 1 deletion(-)
14
15
diff --git a/tests/qemu-iotests/259 b/tests/qemu-iotests/259
16
index XXXXXXX..XXXXXXX 100755
17
--- a/tests/qemu-iotests/259
18
+++ b/tests/qemu-iotests/259
19
@@ -XXX,XX +XXX,XX @@
20
#!/usr/bin/env bash
21
-# group: rw auto quick
22
+# group: rw quick
23
#
24
# Test generic image creation fallback (by using NBD)
25
#
26
--
27
2.29.2
28
29
diff view generated by jsdifflib
Deleted patch
1
From: Maxim Levitsky <mlevitsk@redhat.com>
2
1
3
When the underlying block device doesn't support the
4
bdrv_co_delete_file interface, an 'Error' object was leaked.
5
6
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
7
Reviewed-by: Alberto Garcia <berto@igalia.com>
8
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
9
Message-Id: <20201217170904.946013-2-mlevitsk@redhat.com>
10
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11
---
12
block/crypto.c | 2 ++
13
1 file changed, 2 insertions(+)
14
15
diff --git a/block/crypto.c b/block/crypto.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/block/crypto.c
18
+++ b/block/crypto.c
19
@@ -XXX,XX +XXX,XX @@ fail:
20
*/
21
if ((r_del < 0) && (r_del != -ENOTSUP)) {
22
error_report_err(local_delete_err);
23
+ } else {
24
+ error_free(local_delete_err);
25
}
26
}
27
28
--
29
2.29.2
30
31
diff view generated by jsdifflib
Deleted patch
1
From: Maxim Levitsky <mlevitsk@redhat.com>
2
1
3
This function wraps bdrv_co_delete_file for the common case of removing a file,
4
which was just created by format driver, on an error condition.
5
6
It hides the -ENOTSUPP error, and reports all other errors otherwise.
7
8
Use it in luks driver
9
10
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
11
Reviewed-by: Alberto Garcia <berto@igalia.com>
12
Message-Id: <20201217170904.946013-3-mlevitsk@redhat.com>
13
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
14
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
15
---
16
include/block/block.h | 1 +
17
block.c | 22 ++++++++++++++++++++++
18
block/crypto.c | 15 ++-------------
19
3 files changed, 25 insertions(+), 13 deletions(-)
20
21
diff --git a/include/block/block.h b/include/block/block.h
22
index XXXXXXX..XXXXXXX 100644
23
--- a/include/block/block.h
24
+++ b/include/block/block.h
25
@@ -XXX,XX +XXX,XX @@ int bdrv_freeze_backing_chain(BlockDriverState *bs, BlockDriverState *base,
26
Error **errp);
27
void bdrv_unfreeze_backing_chain(BlockDriverState *bs, BlockDriverState *base);
28
int coroutine_fn bdrv_co_delete_file(BlockDriverState *bs, Error **errp);
29
+void coroutine_fn bdrv_co_delete_file_noerr(BlockDriverState *bs);
30
31
32
typedef struct BdrvCheckResult {
33
diff --git a/block.c b/block.c
34
index XXXXXXX..XXXXXXX 100644
35
--- a/block.c
36
+++ b/block.c
37
@@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_delete_file(BlockDriverState *bs, Error **errp)
38
return ret;
39
}
40
41
+void coroutine_fn bdrv_co_delete_file_noerr(BlockDriverState *bs)
42
+{
43
+ Error *local_err = NULL;
44
+ int ret;
45
+
46
+ if (!bs) {
47
+ return;
48
+ }
49
+
50
+ ret = bdrv_co_delete_file(bs, &local_err);
51
+ /*
52
+ * ENOTSUP will happen if the block driver doesn't support
53
+ * the 'bdrv_co_delete_file' interface. This is a predictable
54
+ * scenario and shouldn't be reported back to the user.
55
+ */
56
+ if (ret == -ENOTSUP) {
57
+ error_free(local_err);
58
+ } else if (ret < 0) {
59
+ error_report_err(local_err);
60
+ }
61
+}
62
+
63
/**
64
* Try to get @bs's logical and physical block size.
65
* On success, store them in @bsz struct and return 0.
66
diff --git a/block/crypto.c b/block/crypto.c
67
index XXXXXXX..XXXXXXX 100644
68
--- a/block/crypto.c
69
+++ b/block/crypto.c
70
@@ -XXX,XX +XXX,XX @@ fail:
71
* If an error occurred, delete 'filename'. Even if the file existed
72
* beforehand, it has been truncated and corrupted in the process.
73
*/
74
- if (ret && bs) {
75
- Error *local_delete_err = NULL;
76
- int r_del = bdrv_co_delete_file(bs, &local_delete_err);
77
- /*
78
- * ENOTSUP will happen if the block driver doesn't support
79
- * the 'bdrv_co_delete_file' interface. This is a predictable
80
- * scenario and shouldn't be reported back to the user.
81
- */
82
- if ((r_del < 0) && (r_del != -ENOTSUP)) {
83
- error_report_err(local_delete_err);
84
- } else {
85
- error_free(local_delete_err);
86
- }
87
+ if (ret) {
88
+ bdrv_co_delete_file_noerr(bs);
89
}
90
91
bdrv_unref(bs);
92
--
93
2.29.2
94
95
diff view generated by jsdifflib
Deleted patch
1
From: Maxim Levitsky <mlevitsk@redhat.com>
2
1
3
If the qcow initialization fails, we should remove the file if it was
4
already created, to avoid leaving stale files around.
5
6
We already do this for luks raw images.
7
8
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
9
Reviewed-by: Alberto Garcia <berto@igalia.com>
10
Message-Id: <20201217170904.946013-4-mlevitsk@redhat.com>
11
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
12
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13
---
14
block/qcow2.c | 8 +++++---
15
1 file changed, 5 insertions(+), 3 deletions(-)
16
17
diff --git a/block/qcow2.c b/block/qcow2.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/block/qcow2.c
20
+++ b/block/qcow2.c
21
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn qcow2_co_create_opts(BlockDriver *drv,
22
23
/* Create the qcow2 image (format layer) */
24
ret = qcow2_co_create(create_options, errp);
25
+finish:
26
if (ret < 0) {
27
- goto finish;
28
+ bdrv_co_delete_file_noerr(bs);
29
+ bdrv_co_delete_file_noerr(data_bs);
30
+ } else {
31
+ ret = 0;
32
}
33
34
- ret = 0;
35
-finish:
36
qobject_unref(qdict);
37
bdrv_unref(bs);
38
bdrv_unref(data_bs);
39
--
40
2.29.2
41
42
diff view generated by jsdifflib
Deleted patch
1
Commit 357bda95 already tried to fix the order in monitor_cleanup() by
2
moving shutdown of the dispatcher coroutine further to the start.
3
However, it didn't go far enough:
4
1
5
iothread_stop() makes sure that all pending work (bottom halves) in the
6
AioContext of the monitor iothread is completed. iothread_destroy()
7
depends on this and fails an assertion if there is still a pending BH.
8
9
While the dispatcher coroutine is running, it will try to resume the
10
monitor after taking a request out of the queue, which involves a BH.
11
The dispatcher is run until it terminates in the AIO_WAIT_WHILE() loop.
12
However, adding new BHs between iothread_stop() and iothread_destroy()
13
is forbidden.
14
15
Fix this by stopping the dispatcher first before shutting down the other
16
parts of the monitor. This means we can now receive requests that aren't
17
handled any more when QEMU is shutting down, but this is unlikely to be
18
a problem for QMP clients.
19
20
Fixes: 357bda9590784ff75803d52de43150d4107ed98e
21
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
22
Message-Id: <20210212172028.288825-2-kwolf@redhat.com>
23
Tested-by: Markus Armbruster <armbru@redhat.com>
24
Reviewed-by: Markus Armbruster <armbru@redhat.com>
25
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
26
---
27
monitor/monitor.c | 25 +++++++++++++++----------
28
1 file changed, 15 insertions(+), 10 deletions(-)
29
30
diff --git a/monitor/monitor.c b/monitor/monitor.c
31
index XXXXXXX..XXXXXXX 100644
32
--- a/monitor/monitor.c
33
+++ b/monitor/monitor.c
34
@@ -XXX,XX +XXX,XX @@ void monitor_data_destroy(Monitor *mon)
35
36
void monitor_cleanup(void)
37
{
38
- /*
39
- * We need to explicitly stop the I/O thread (but not destroy it),
40
- * clean up the monitor resources, then destroy the I/O thread since
41
- * we need to unregister from chardev below in
42
- * monitor_data_destroy(), and chardev is not thread-safe yet
43
- */
44
- if (mon_iothread) {
45
- iothread_stop(mon_iothread);
46
- }
47
-
48
/*
49
* The dispatcher needs to stop before destroying the monitor and
50
* the I/O thread.
51
@@ -XXX,XX +XXX,XX @@ void monitor_cleanup(void)
52
* eventually terminates. qemu_aio_context is automatically
53
* polled by calling AIO_WAIT_WHILE on it, but we must poll
54
* iohandler_ctx manually.
55
+ *
56
+ * Letting the iothread continue while shutting down the dispatcher
57
+ * means that new requests may still be coming in. This is okay,
58
+ * we'll just leave them in the queue without sending a response
59
+ * and monitor_data_destroy() will free them.
60
*/
61
qmp_dispatcher_co_shutdown = true;
62
if (!qatomic_xchg(&qmp_dispatcher_co_busy, true)) {
63
@@ -XXX,XX +XXX,XX @@ void monitor_cleanup(void)
64
(aio_poll(iohandler_get_aio_context(), false),
65
qatomic_mb_read(&qmp_dispatcher_co_busy)));
66
67
+ /*
68
+ * We need to explicitly stop the I/O thread (but not destroy it),
69
+ * clean up the monitor resources, then destroy the I/O thread since
70
+ * we need to unregister from chardev below in
71
+ * monitor_data_destroy(), and chardev is not thread-safe yet
72
+ */
73
+ if (mon_iothread) {
74
+ iothread_stop(mon_iothread);
75
+ }
76
+
77
/* Flush output buffers and destroy monitors */
78
qemu_mutex_lock(&monitor_lock);
79
monitor_destroyed = true;
80
--
81
2.29.2
82
83
diff view generated by jsdifflib
Deleted patch
1
Before this patch, monitor_qmp_dispatcher_co() used to check whether
2
shutdown is requested only when it would have to wait for new requests.
3
If there were still some queued requests, it would try to execute all of
4
them before shutting down.
5
1
6
This can be surprising when the queued QMP commands take long or hang
7
because Ctrl-C may not actually exit QEMU as soon as possible.
8
9
Change monitor_qmp_dispatcher_co() so that it additionally checks
10
whether shutdown is request before it gets a new request from the queue.
11
12
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13
Message-Id: <20210212172028.288825-3-kwolf@redhat.com>
14
Tested-by: Markus Armbruster <armbru@redhat.com>
15
Reviewed-by: Markus Armbruster <armbru@redhat.com>
16
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
17
---
18
monitor/qmp.c | 5 +++++
19
1 file changed, 5 insertions(+)
20
21
diff --git a/monitor/qmp.c b/monitor/qmp.c
22
index XXXXXXX..XXXXXXX 100644
23
--- a/monitor/qmp.c
24
+++ b/monitor/qmp.c
25
@@ -XXX,XX +XXX,XX @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data)
26
*/
27
qatomic_mb_set(&qmp_dispatcher_co_busy, false);
28
29
+ /* On shutdown, don't take any more requests from the queue */
30
+ if (qmp_dispatcher_co_shutdown) {
31
+ return;
32
+ }
33
+
34
while (!(req_obj = monitor_qmp_requests_pop_any_with_lock())) {
35
/*
36
* No more requests to process. Wait to be reentered from
37
--
38
2.29.2
39
40
diff view generated by jsdifflib