[dpdk-dev] [PATCH 1/3] vhost: fix deadlock due to vhostuser socket and fdset

Maxime Coquelin maxime.coquelin at redhat.com
Fri May 4 17:11:29 CEST 2018



On 04/27/2018 05:19 PM, xiangxia.m.yue at gmail.com wrote:
> From: Tonghao Zhang <xiangxia.m.yue at gmail.com>
> 
> When qemu close the unix socket fd of the vhostuser as a
> server, and then immediately delete the vhostuser port on
> openvswitch. There will be a deadlock.
> 
> A thread (fdset event thread):       B thread:
> 1. fdset_event_dispatch              rte_vhost_driver_unregister
> 2. set the fd busy to 1.             lock vsocket->conn_mutex
> 3. vhost_user_read_cb                fdset_del waits busy changed to 0.
> 4. vhost peer closed, remove the
>     conn from vsocket->conn_list:
>     lock vsocket->conn_mutex
> 
> 5. set the fd busy to 0
> 
> Fixes: 65388b43 ("vhost: fix fd leaks for vhost-user server mode")
> Cc: stable at dpdk.org
> Cc: Yuanhan Liu <yliu at fridaylinux.org>
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue at gmail.com>
> ---
>   lib/librte_vhost/fd_man.c | 32 ++++++++++++++++++++++++++++++++
>   lib/librte_vhost/fd_man.h |  1 +
>   lib/librte_vhost/socket.c | 13 ++++++++++++-
>   3 files changed, 45 insertions(+), 1 deletion(-)
> 

Applied to dpdk-next-virtio/master.

Please next time add a cover-letter and run check-git-log.sh and
checkpatch.sh scripts before submitting.

Thanks!
Maxime


More information about the dev mailing list