Skip to content

Commit

Permalink
vhost: fix remove vf reconnect crash
Browse files Browse the repository at this point in the history
In rte_vhost_driver_unregister which is called from vdpa-rpc thread,
vsocket should be removed from reconn_list again after remove vsocket
from conn_list. Because vhost_user_read_cb which is called in vhost-events
thread can add vsocket to reconn_list again.

When qemu close domain socket server, vhost_user_read_cb will be called
to clean up vhost device.

vsocket->path is NULL

    #0  0x00007f07665834d1 in __strnlen_sse2 () from /lib64/libc.so.6
    Mellanox#1  0x00007f076aee79da in vhost_user_add_connection (fd=160, vsocket=0x7f070406d160) at ../lib/vhost/socket.c:226
    Mellanox#2  0x00007f076aee7d63 in vhost_user_client_reconnect (arg=<optimized out>) at ../lib/vhost/socket.c:481
    Mellanox#3  0x00007f07668cbdd5 in start_thread () from /lib64/libpthread.so.0
    Mellanox#4  0x00007f07665f4ead in clone () from /lib64/libc.so.6

RM: 3585558
Signed-off-by: Yajun Wu <yajunw@nvidia.com>
  • Loading branch information
yajwu committed Aug 28, 2023
1 parent ac9e7be commit a8d5ddb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/vhost/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,8 @@ rte_vhost_driver_unregister(const char *path)
if (vsocket->is_server) {
close(vsocket->socket_fd);
unlink(path);
} else if (vsocket->reconnect) {
vhost_user_remove_reconnect(vsocket);
}

pthread_mutex_destroy(&vsocket->conn_mutex);
Expand Down

0 comments on commit a8d5ddb

Please sign in to comment.