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