On Thu, 2016-03-31 at 18:39 -0700, Eric Dumazet wrote: > On Fri, 2016-04-01 at 03:36 +0200, Hannes Frederic Sowa wrote: > > On Fri, Apr 1, 2016, at 03:19, Eric Dumazet wrote: > > > Thanks. > > > > > > As you can see, release_sock() messes badly lockdep (once your other > > > patches are in ) > > > > > > Once we properly fix release_sock() and/or __release_sock(), all these > > > false positives disappear. > > > > This was a loopback connection. I need to study release_sock and > > __release_sock more as I cannot currently see an issue with the lockdep > > handling. > > Okay, please try : > > diff --git a/net/core/sock.c b/net/core/sock.c > index b67b9aedb230..570dcd91d64e 100644 > --- a/net/core/sock.c > +++ b/net/core/sock.c > @@ -2429,10 +2429,6 @@ EXPORT_SYMBOL(lock_sock_nested); > > void release_sock(struct sock *sk) > { > - /* > - * The sk_lock has mutex_unlock() semantics: > - */ > - mutex_release(&sk->sk_lock.dep_map, 1, _RET_IP_); > > spin_lock_bh(&sk->sk_lock.slock); > if (sk->sk_backlog.tail) > @@ -2445,6 +2441,10 @@ void release_sock(struct sock *sk) > sk->sk_prot->release_cb(sk); > > sock_release_ownership(sk); > + /* > + * The sk_lock has mutex_unlock() semantics: > + */ > + mutex_release(&sk->sk_lock.dep_map, 1, _RET_IP_); > if (waitqueue_active(&sk->sk_lock.wq)) > wake_up(&sk->sk_lock.wq); > spin_unlock_bh(&sk->sk_lock.slock);
Also take a look at commit c3f9b01849ef3bc69024990092b9f42e20df7797 We might need to include the mutex_release() in sock_release_ownership() Thanks !