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