vhost: wrap vhost_user_read_cb with vhost_user mutex
This fixes spontaneous vhost hangs on SIGINT shutdown. Apperently during vhost_destroy_device(conn->vid) from line #284 another QEMU message might arrive, causing vsocket->conn_mutex deadlock. (line #286) Change-Id: I4f1c31a52facffd1eb1e1192591095f00da55031 Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
This commit is contained in:
parent
f4cd3c08dd
commit
6973898164
@ -277,6 +277,8 @@ vhost_user_read_cb(int connfd, void *dat, int *remove)
|
|||||||
|
|
||||||
ret = vhost_user_msg_handler(conn->vid, connfd);
|
ret = vhost_user_msg_handler(conn->vid, connfd);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
pthread_mutex_lock(&vhost_user.mutex);
|
||||||
|
|
||||||
close(connfd);
|
close(connfd);
|
||||||
*remove = 1;
|
*remove = 1;
|
||||||
vhost_destroy_device(conn->vid);
|
vhost_destroy_device(conn->vid);
|
||||||
@ -291,6 +293,8 @@ vhost_user_read_cb(int connfd, void *dat, int *remove)
|
|||||||
create_unix_socket(vsocket);
|
create_unix_socket(vsocket);
|
||||||
vhost_user_start_client(vsocket);
|
vhost_user_start_client(vsocket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pthread_mutex_unlock(&vhost_user.mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user