vhost: fix async unregister deadlock
authorPatrick Fu <patrick.fu@intel.com>
Tue, 13 Oct 2020 01:45:46 +0000 (09:45 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 16 Oct 2020 17:48:19 +0000 (19:48 +0200)
commiteb666d24085fd21f0a087dcfb2be9baa8287707d
tree405f6dcef8809ca5f088bb8b50a6015b1e2442ab
parent3e1e9c24648a44f10c4e3f04f016cdb881535218
vhost: fix async unregister deadlock

When async unregister function is invoked in certain vhost event
callbacks (e.g. vring state change), deadlock may occur due to
recursive spinlock acquire. This patch uses trylock() primitive in
the unregister API to avoid deadlock.

Fixes: 78639d54563a ("vhost: introduce async enqueue registration API")
Cc: stable@dpdk.org
Signed-off-by: Patrick Fu <patrick.fu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
lib/librte_vhost/vhost.c
lib/librte_vhost/vhost_user.c