Skip to contentSkip to conversation

block/replication.c: Fix crash issue after failover

PATCH Superseded Zhang Chen 1 participant 2 messages Jun 21, 2019 Block layer

lore
Share & tools
lore

Zhang Chen

author
#0 lore raw

PATCH v2 1/1 block/replication.c: Fix crash issue after failover

From: Zhang Chen <[email protected]>

If we try to close replication after failover, it will crash here. So we need check the block job on active disk before cancel the job.

---
 block/replication.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
block/replication.c +3 -1
index 3d4dedddfc..845f796dd4 100644
@@ -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->active_disk->bs->job) {
+            job_cancel_sync(&s->active_disk->bs->job->job);
+        }
     }
 
     if (s->mode == REPLICATION_MODE_SECONDARY) {
Signature · 1 line
2.17.GIT
#1 lore raw

Please redirect to the V2 RESEND patch, this one not rebased on upstream code.

Thanks
Zhang Chen

Quoted 36 lines

-----Original Message-----
From: Zhang, Chen
Sent: Friday, June 21, 2019 1:52 PM
To: Xie Changlong <[email protected]>; Kevin Wolf <[email protected]>; Max Reitz <[email protected]>; qemu-block <qemu- [email protected]>; qemu-dev <[email protected]>
Cc: Zhang Chen <[email protected]>; Zhang, Chen <[email protected]>
Subject: [PATCH V2] block/replication.c: Fix crash issue after failover

From: Zhang Chen <[email protected]>

If we try to close replication after failover, it will crash here. So we need check the block job on active disk before cancel the job.

---
 block/replication.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
block/replication.c index renamed from block/replication.c +0 -0

3d4dedddfc..845f796dd4 100644

block/replication.c +3 -2
@@ -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->active_disk->bs->job) {
+            job_cancel_sync(&s->active_disk->bs->job->job);
+        }
     }
 
     if (s->mode == REPLICATION_MODE_SECONDARY) {
--

2.17.GIT