902636
From 27fe3b8d42a2c99de01ce20e4b0727079c12da65 Mon Sep 17 00:00:00 2001
902636
From: Kevin Wolf <kwolf@redhat.com>
902636
Date: Mon, 24 Feb 2020 16:57:09 +0000
902636
Subject: [PATCH 8/9] mirror: Store MirrorOp.co for debuggability
902636
902636
RH-Author: Kevin Wolf <kwolf@redhat.com>
902636
Message-id: <20200224165710.4830-2-kwolf@redhat.com>
902636
Patchwork-id: 94044
902636
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 1/2] mirror: Store MirrorOp.co for debuggability
902636
Bugzilla: 1794692
902636
RH-Acked-by: John Snow <jsnow@redhat.com>
902636
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
902636
RH-Acked-by: Max Reitz <mreitz@redhat.com>
902636
902636
If a coroutine is launched, but the coroutine pointer isn't stored
902636
anywhere, debugging any problems inside the coroutine is quite hard.
902636
Let's store the coroutine pointer of a mirror operation in MirrorOp to
902636
have it available in the debugger.
902636
902636
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
902636
Reviewed-by: Eric Blake <eblake@redhat.com>
902636
(cherry picked from commit eed325b92c3e68417121ea23f96e33af6a4654ed)
902636
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
902636
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
902636
---
902636
 block/mirror.c | 2 ++
902636
 1 file changed, 2 insertions(+)
902636
902636
diff --git a/block/mirror.c b/block/mirror.c
902636
index f0f2d9d..8959e42 100644
902636
--- a/block/mirror.c
902636
+++ b/block/mirror.c
902636
@@ -103,6 +103,7 @@ struct MirrorOp {
902636
     bool is_pseudo_op;
902636
     bool is_active_write;
902636
     CoQueue waiting_requests;
902636
+    Coroutine *co;
902636
 
902636
     QTAILQ_ENTRY(MirrorOp) next;
902636
 };
902636
@@ -429,6 +430,7 @@ static unsigned mirror_perform(MirrorBlockJob *s, int64_t offset,
902636
     default:
902636
         abort();
902636
     }
902636
+    op->co = co;
902636
 
902636
     QTAILQ_INSERT_TAIL(&s->ops_in_flight, op, next);
902636
     qemu_coroutine_enter(co);
902636
-- 
902636
1.8.3.1
902636