All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] sheepdog driver patch: fixs the problem of qemu process become crashed when the sheepdog gateway break the IO and then recover
@ 2020-10-01  2:21 mingwei
  2020-10-02 11:46 ` Kevin Wolf
  0 siblings, 1 reply; 2+ messages in thread
From: mingwei @ 2020-10-01  2:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, sheepdog, qemu-block, mreitz, mingwei, namei.unix

this patch fixs the problem of qemu process become crashed when the sheepdog gateway break the IO for a few seconds and then recover.

problem reproduce:
1.start a fio process in qemu to produce IOs to sheepdog gateway, whatever IO type you like.
2.kill the sheepdog gateway.
3.wait for a few seconds.
4.restart the sheepdog gateway.
5.qemu process crashed with segfault error 6.

problem cause:
the last io coroutine will be destroyed after reconnect to sheepdog gateway, but the coroutine still be scheduled and the s->co_recv is still the last io coroutine pointer which had been destroyed, so when this coroutine go to coroutine context switch, it will make qemu process crashed.

problem fix:
just make s->co_recv = NULL when the last io coroutine reconnect to sheepdog gateway.

Signed-off-by: mingwei <gongwilliam@163.com>
---
 block/sheepdog.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/sheepdog.c b/block/sheepdog.c
index 2f5c0eb376..3a00f0c1e1 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -727,6 +727,7 @@ static coroutine_fn void reconnect_to_sdog(void *opaque)
                        NULL, NULL, NULL);
     close(s->fd);
     s->fd = -1;
+    s->co_recv = NULL;
 
     /* Wait for outstanding write requests to be completed. */
     while (s->co_send != NULL) {
-- 
2.25.1




^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-02 11:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-01  2:21 [PATCH v1 1/1] sheepdog driver patch: fixs the problem of qemu process become crashed when the sheepdog gateway break the IO and then recover mingwei
2020-10-02 11:46 ` Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.