From: Tonghao Zhang <xiangxia.m....@gmail.com>

Use the VHOST_NET_VQ_XXX as a subclass for mutex_lock_nested.

Signed-off-by: Tonghao Zhang <xiangxia.m....@gmail.com>
Acked-by: Jason Wang <jasow...@redhat.com>
---
 drivers/vhost/net.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 367d802..32c1b52 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -712,7 +712,7 @@ static void handle_tx(struct vhost_net *net)
        struct vhost_virtqueue *vq = &nvq->vq;
        struct socket *sock;
 
-       mutex_lock(&vq->mutex);
+       mutex_lock_nested(&vq->mutex, VHOST_NET_VQ_TX);
        sock = vq->private_data;
        if (!sock)
                goto out;
@@ -777,7 +777,7 @@ static int vhost_net_rx_peek_head_len(struct vhost_net 
*net, struct sock *sk,
                /* Flush batched heads first */
                vhost_net_signal_used(rnvq);
                /* Both tx vq and rx socket were polled here */
-               mutex_lock_nested(&tvq->mutex, 1);
+               mutex_lock_nested(&tvq->mutex, VHOST_NET_VQ_TX);
                vhost_disable_notify(&net->dev, tvq);
 
                preempt_disable();
@@ -919,7 +919,7 @@ static void handle_rx(struct vhost_net *net)
        __virtio16 num_buffers;
        int recv_pkts = 0;
 
-       mutex_lock_nested(&vq->mutex, 0);
+       mutex_lock_nested(&vq->mutex, VHOST_NET_VQ_RX);
        sock = vq->private_data;
        if (!sock)
                goto out;
-- 
1.8.3.1

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Reply via email to