[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [RFC v4 4/6] virtio/vhost-vsock: Use nested lock notation
On Thu, Mar 31, 2016 at 01:41:36PM +0200, Claudio Imbrenda wrote: > Since the socket was created locally and wasn't passed around, nobody can > have a reference to it yet, so locking it shouldn't block, therefore no > deadlock should be possible. > I'm not sure why, if at all, it is needed to lock the child socket there, > but this patch makes sure that lockdep is happy, and hopefully it doesn't > mask an actual deadlock. > > Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com> > --- > net/vmw_vsock/virtio_transport_common.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c > index fa54359..6698b61 100644 > --- a/net/vmw_vsock/virtio_transport_common.c > +++ b/net/vmw_vsock/virtio_transport_common.c > @@ -792,7 +792,7 @@ virtio_transport_recv_listen(struct sock *sk, struct virtio_vsock_pkt *pkt) > > sk->sk_ack_backlog++; > > - lock_sock(child); > + lock_sock_nested(child, SINGLE_DEPTH_NESTING); This looks good. The same approach is used in other network protocols when processing an incoming connection to a listen socket. Regarding lock ordering, there is no other case where we take another socket B's lock while holding A's lock so deadlock is not possible. I think the VMCI transport has the same issue in vmci_transport_recv_listen() when there are pending connections. I've CCed Jorgen in case he feels it's worth fixing in the VMCI transport. Stefan
Attachment:
signature.asc
Description: PGP signature
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]