[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] vhost-user-blk.c:fix the qemu-kvm crash in the vhost-user-blk en

From: Bobo Du
Subject: [PATCH] vhost-user-blk.c:fix the qemu-kvm crash in the vhost-user-blk env.
Date: Wed, 20 Jan 2021 11:50:27 +0800

In our spdk env, when we restart spdk vhost process, all the spdk
vhost dev will be reconnected,if the vhost_user_blk_device_realize
failed in the reconnect code goto label with the qemu_chr_fe_wait_connected,
the vhost_user_cleanup will set user->chr be NULL,but the fe handler
vhost_user_blk_event is still work on the env.

If the vhost slave(eg:spdk) has not been done,we will see the qemu-kvm
crash after reopen the vhost-user-blk dev:
gdb debug info from qemu-kvm-2.10:
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/usr/libexec/qemu-kvm -name 
Program terminated with signal 11, Segmentation fault.
#0  qemu_chr_fe_set_msgfds (be=0x0, fds=0x0, num=0) at chardev/char-fe.c:144
144        Chardev *s = be->chr;

So,we must reset the fe handler after the goto label virtio_err.

Signed-off-by: Bobo Du <dubo163@126.com>
 hw/block/vhost-user-blk.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index da4fbf9084..c90687ab82 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -507,6 +507,8 @@ virtio_err:
+    qemu_chr_fe_set_handlers(&s->chardev, NULL, NULL, NULL,
+                             NULL, NULL, NULL, false);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]