diff options
author | Kevin Wolf <kwolf@redhat.com> | 2019-07-22 17:46:23 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2019-08-16 10:25:16 +0200 |
commit | cf3129323f900ef5ddbccbe86e4fa801e88c566e (patch) | |
tree | ba516ad030d6a983ba70a16264c8c5a9dfea15a8 /block/commit.c | |
parent | d2da5e288a2e71e82866c8fdefd41b5727300124 (diff) | |
download | qemu-cf3129323f900ef5ddbccbe86e4fa801e88c566e.zip qemu-cf3129323f900ef5ddbccbe86e4fa801e88c566e.tar.gz qemu-cf3129323f900ef5ddbccbe86e4fa801e88c566e.tar.bz2 |
block-backend: Queue requests while drained
This fixes devices like IDE that can still start new requests from I/O
handlers in the CPU thread while the block backend is drained.
The basic assumption is that in a drain section, no new requests should
be allowed through a BlockBackend (blk_drained_begin/end don't exist,
we get drain sections only on the node level). However, there are two
special cases where requests should not be queued:
1. Block jobs: We already make sure that block jobs are paused in a
drain section, so they won't start new requests. However, if the
drain_begin is called on the job's BlockBackend first, it can happen
that we deadlock because the job stays busy until it reaches a pause
point - which it can't if its requests aren't processed any more.
The proper solution here would be to make all requests through the
job's filter node instead of using a BlockBackend. For now, just
disabling request queuing on the job BlockBackend is simpler.
2. In test cases where making requests through bdrv_* would be
cumbersome because we'd need a BdrvChild. As we already got the
functionality to disable request queuing from 1., use it in tests,
too, for convenience.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/commit.c')
-rw-r--r-- | block/commit.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/block/commit.c b/block/commit.c index 2c5a6d4..408ae15 100644 --- a/block/commit.c +++ b/block/commit.c @@ -350,6 +350,7 @@ void commit_start(const char *job_id, BlockDriverState *bs, if (ret < 0) { goto fail; } + blk_set_disable_request_queuing(s->base, true); s->base_bs = base; /* Required permissions are already taken with block_job_add_bdrv() */ @@ -358,6 +359,7 @@ void commit_start(const char *job_id, BlockDriverState *bs, if (ret < 0) { goto fail; } + blk_set_disable_request_queuing(s->top, true); s->backing_file_str = g_strdup(backing_file_str); s->on_error = on_error; |