|
|
bf143f |
From b1f5aa5a342a25dc558ee9d435fed0643fe5155f Mon Sep 17 00:00:00 2001
|
|
|
bf143f |
From: Hanna Reitz <hreitz@redhat.com>
|
|
|
bf143f |
Date: Wed, 9 Nov 2022 17:54:50 +0100
|
|
|
bf143f |
Subject: [PATCH 03/11] block/mirror: Fix NULL s->job in active writes
|
|
|
bf143f |
|
|
|
bf143f |
RH-Author: Hanna Czenczek <hreitz@redhat.com>
|
|
|
bf143f |
RH-MergeRequest: 246: block/mirror: Make active mirror progress even under full load
|
|
|
bf143f |
RH-Bugzilla: 2125119
|
|
|
bf143f |
RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
|
|
bf143f |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
bf143f |
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
bf143f |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
bf143f |
RH-Commit: [3/3] 49d7ebd15667151a6e14228a8260cfdd0aa27a78
|
|
|
bf143f |
|
|
|
bf143f |
There is a small gap in mirror_start_job() before putting the mirror
|
|
|
bf143f |
filter node into the block graph (bdrv_append() call) and the actual job
|
|
|
bf143f |
being created. Before the job is created, MirrorBDSOpaque.job is NULL.
|
|
|
bf143f |
|
|
|
bf143f |
It is possible that requests come in when bdrv_drained_end() is called,
|
|
|
bf143f |
and those requests would see MirrorBDSOpaque.job == NULL. Have our
|
|
|
bf143f |
filter node handle that case gracefully.
|
|
|
bf143f |
|
|
|
bf143f |
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
|
|
|
bf143f |
Message-Id: <20221109165452.67927-4-hreitz@redhat.com>
|
|
|
bf143f |
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
bf143f |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
bf143f |
(cherry picked from commit da93d5c84e56e6b4e84aa8e98b6b984c9b6bb528)
|
|
|
bf143f |
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
|
|
|
bf143f |
---
|
|
|
bf143f |
block/mirror.c | 20 ++++++++++++--------
|
|
|
bf143f |
1 file changed, 12 insertions(+), 8 deletions(-)
|
|
|
bf143f |
|
|
|
bf143f |
diff --git a/block/mirror.c b/block/mirror.c
|
|
|
bf143f |
index 6b02555ad7..50289fca49 100644
|
|
|
bf143f |
--- a/block/mirror.c
|
|
|
bf143f |
+++ b/block/mirror.c
|
|
|
bf143f |
@@ -1438,11 +1438,13 @@ static int coroutine_fn bdrv_mirror_top_do_write(BlockDriverState *bs,
|
|
|
bf143f |
MirrorOp *op = NULL;
|
|
|
bf143f |
MirrorBDSOpaque *s = bs->opaque;
|
|
|
bf143f |
int ret = 0;
|
|
|
bf143f |
- bool copy_to_target;
|
|
|
bf143f |
+ bool copy_to_target = false;
|
|
|
bf143f |
|
|
|
bf143f |
- copy_to_target = s->job->ret >= 0 &&
|
|
|
bf143f |
- !job_is_cancelled(&s->job->common.job) &&
|
|
|
bf143f |
- s->job->copy_mode == MIRROR_COPY_MODE_WRITE_BLOCKING;
|
|
|
bf143f |
+ if (s->job) {
|
|
|
bf143f |
+ copy_to_target = s->job->ret >= 0 &&
|
|
|
bf143f |
+ !job_is_cancelled(&s->job->common.job) &&
|
|
|
bf143f |
+ s->job->copy_mode == MIRROR_COPY_MODE_WRITE_BLOCKING;
|
|
|
bf143f |
+ }
|
|
|
bf143f |
|
|
|
bf143f |
if (copy_to_target) {
|
|
|
bf143f |
op = active_write_prepare(s->job, offset, bytes);
|
|
|
bf143f |
@@ -1487,11 +1489,13 @@ static int coroutine_fn bdrv_mirror_top_pwritev(BlockDriverState *bs,
|
|
|
bf143f |
QEMUIOVector bounce_qiov;
|
|
|
bf143f |
void *bounce_buf;
|
|
|
bf143f |
int ret = 0;
|
|
|
bf143f |
- bool copy_to_target;
|
|
|
bf143f |
+ bool copy_to_target = false;
|
|
|
bf143f |
|
|
|
bf143f |
- copy_to_target = s->job->ret >= 0 &&
|
|
|
bf143f |
- !job_is_cancelled(&s->job->common.job) &&
|
|
|
bf143f |
- s->job->copy_mode == MIRROR_COPY_MODE_WRITE_BLOCKING;
|
|
|
bf143f |
+ if (s->job) {
|
|
|
bf143f |
+ copy_to_target = s->job->ret >= 0 &&
|
|
|
bf143f |
+ !job_is_cancelled(&s->job->common.job) &&
|
|
|
bf143f |
+ s->job->copy_mode == MIRROR_COPY_MODE_WRITE_BLOCKING;
|
|
|
bf143f |
+ }
|
|
|
bf143f |
|
|
|
bf143f |
if (copy_to_target) {
|
|
|
bf143f |
/* The guest might concurrently modify the data to write; but
|
|
|
bf143f |
--
|
|
|
bf143f |
2.37.3
|
|
|
bf143f |
|