summaryrefslogtreecommitdiffstats
path: root/drivers/vhost/net.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/vhost/net.c')
-rw-r--r--drivers/vhost/net.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index ab11b2bee273..ad7a6f475a44 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -513,7 +513,13 @@ static void vhost_net_busy_poll(struct vhost_net *net,
513 struct socket *sock; 513 struct socket *sock;
514 struct vhost_virtqueue *vq = poll_rx ? tvq : rvq; 514 struct vhost_virtqueue *vq = poll_rx ? tvq : rvq;
515 515
516 mutex_lock_nested(&vq->mutex, poll_rx ? VHOST_NET_VQ_TX: VHOST_NET_VQ_RX); 516 /* Try to hold the vq mutex of the paired virtqueue. We can't
517 * use mutex_lock() here since we could not guarantee a
518 * consistenet lock ordering.
519 */
520 if (!mutex_trylock(&vq->mutex))
521 return;
522
517 vhost_disable_notify(&net->dev, vq); 523 vhost_disable_notify(&net->dev, vq);
518 sock = rvq->private_data; 524 sock = rvq->private_data;
519 525