]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
net: vhost: replace magic number of lock annotation
authorTonghao Zhang <xiangxia.m.yue@gmail.com>
Tue, 25 Sep 2018 12:36:50 +0000 (05:36 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 27 Sep 2018 03:25:55 +0000 (20:25 -0700)
Use the VHOST_NET_VQ_XXX as a subclass for mutex_lock_nested.

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/vhost/net.c

index 1bff6bc8161a8a398831bcf5f65d3e825508c49c..5fe57ab968c32d3c37d297d81546232c20fd30a4 100644 (file)
@@ -856,7 +856,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;
@@ -921,7 +921,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();
@@ -1063,7 +1063,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;