> -----Original Message----- > From: Kevin Wolf [mailto:kw...@redhat.com] > Sent: Friday, June 14, 2019 6:18 PM > To: Zhang, Chen <chen.zh...@intel.com> > Cc: Xie Changlong <xiechanglon...@gmail.com>; Max Reitz > <mre...@redhat.com>; qemu-block <qemu-bl...@nongnu.org>; qemu-dev > <qemu-devel@nongnu.org>; Zhang Chen <zhangc...@gmail.com>; > vsement...@virtuozzo.com > Subject: Re: [PATCH] block/replication.c: Fix crash issue after failover > > Am 14.06.2019 um 11:28 hat Zhang Chen geschrieben: > > From: Zhang Chen <chen.zh...@intel.com> > > > > No block job on active disk after failover. > > In the replication_stop() function have canceled the block job, we > > check it again here. > > > > Signed-off-by: Zhang Chen <chen.zh...@intel.com> > > --- > > block/replication.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/block/replication.c b/block/replication.c index > > 3d4dedddfc..bdf2bf4bbc 100644 > > --- a/block/replication.c > > +++ b/block/replication.c > > @@ -146,7 +146,9 @@ static void replication_close(BlockDriverState *bs) > > replication_stop(s->rs, false, NULL); > > } > > if (s->stage == BLOCK_REPLICATION_FAILOVER) { > > - job_cancel_sync(&s->active_disk->bs->job->job); > > + if (s->secondary_disk->bs->job) { > > + job_cancel_sync(&s->secondary_disk->bs->job->job); > > + } > > Why are you changing the code from active_disk to secondary_disk? >
Sorry, It seems that I misunderstood the original code. I have re-checked the code, looks in the "commit_active_start()" create a job for the active_disk. But in my test, when occur failover, running to the " replication_close() " the active_disk's job always = 0, It will crash here: job_cancel_sync(&s->active_disk->bs->job->job); So, I will add a check here: if (s->active_disk->bs->job) { job_cancel_sync(&s->active_disk->bs->job->job); } What do you think? > Also, please rebase on top of Vladimir's '[PATCH 0/4] block: drop > bs->job'. Sure. Thanks Zhang Chen > > Kevin