vhost: fix deadlock on port deletion
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Tue, 14 Jan 2020 18:53:57 +0000 (19:53 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 17 Jan 2020 18:46:26 +0000 (19:46 +0100)
commit5efb18e85f7fdb436d3e56591656051c16802066
tree1e90b3fc2d368371cb60cbfa30e99c7db7eda08f
parent1ad2f882b34a644d4dc91b366f38a73a1b4f4cf5
vhost: fix deadlock on port deletion

If the vhost-user application (e.g. OVS) deletes the vhost-user
port while Qemu sends a vhost-user request, a deadlock can
happen if the request handler tries to acquire vhost-user's
global mutex, which is also locked by the vhost-user port
deletion API (rte_vhost_driver_unregister).

This patch prevents the deadlock by making
rte_vhost_driver_unregister() to release the mutex and try
again if a request is being handled to give a chance to
the request handler to complete.

Fixes: 8b4b949144b8 ("vhost: fix dead lock on closing in server mode")
Fixes: 5fbb3941da9f ("vhost: introduce driver features related APIs")
Cc: stable@dpdk.org
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
lib/librte_vhost/socket.c