]> git.baikalelectronics.ru Git - kernel.git/commit
vhost_net: switch to use mutex_trylock() in vhost_net_busy_poll()
authorJason Wang <jasowang@redhat.com>
Thu, 13 Dec 2018 02:53:38 +0000 (10:53 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 13 Dec 2018 05:56:19 +0000 (21:56 -0800)
commitb61deed67e833ce120bf3f39f1886d2ce91d8d60
treeffde46b13664033e1a41fffbe4c80720ee86868c
parentf95fde0de88edb57d74209c17a0bb74f3c7e5617
vhost_net: switch to use mutex_trylock() in vhost_net_busy_poll()

We used to hold the mutex of paired virtqueue in
vhost_net_busy_poll(). But this will results an inconsistent lock
order which may cause deadlock if we try to bring back the protection
of device IOTLB with vq mutex that requires to hold mutex of all
virtqueues at the same time.

Fix this simply by switching to use mutex_trylock(), when fail just
skip the busy polling. This can happen when device IOTLB is under
updating which should be rare.

Fixes: commit 6ecc039be5f7 ("net: vhost: lock the vqs one by one")
Cc: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/vhost/net.c