[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1285218300.2380.68.camel@edumazet-laptop>
Date: Thu, 23 Sep 2010 07:05:00 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Miller <davem@...emloft.net>
Cc: jarkao2@...il.com, penguin-kernel@...ove.SAKURA.ne.jp,
linux-fsdevel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH] net: fix a lockdep splat
Le mercredi 22 septembre 2010 à 21:23 -0700, David Miller a écrit :
> From: David Miller <davem@...emloft.net>
> Date: Wed, 22 Sep 2010 20:53:24 -0700 (PDT)
>
> > From: Eric Dumazet <eric.dumazet@...il.com>
> > Date: Thu, 23 Sep 2010 00:43:39 +0200
> >
> >> (A) (this is used in net/sunrpc/xprtsock.c)
> >> read_lock(&sk->sk_callback_lock) (without blocking BH)
> >> <BH>
> >> spin_lock(&sk->sk_slock.slock);
> >> ...
> >> read_lock(&sk->sk_callback_lock);
> >> ...
> >
> > What's the exact path that leads to this? I looked quickly and couldn't
> > find which sunrpc callback override does it.
>
> Sorry, I'm being unusually dense at the moment, ignore this question :-)
No problem ;)
But we might answer it anyway for other readers :
vi +1417 net/sunrpc/xprtsock.c
static void xs_udp_write_space(struct sock *sk)
{
read_lock(&sk->sk_callback_lock);
// We can be interrupted here and call INPUT_PATH()
/* from net/core/sock.c:sock_def_write_space */
if (sock_writeable(sk))
xs_write_space(sk);
read_unlock(&sk->sk_callback_lock);
}
INPUT_PATH()
{
spin_lock(&sk->slock);
queue skb to receive queue or backlog
spin_unlock(&sk->slock);
}
If another cpu does (C), we can deadlock.
C)
spin_lock_bh(&sk->sk_slock)
...
write_lock_bh(&sk->sk_callback_lock)
...
Then we can have a deadlock with (A)
CPU1 [A] CPU2 [C]
read_lock(&sk->sk_callback_lock)
<BH> spin_lock_bh(&sk->sk_slock)
<wait to spin_lock(slock)>
<wait to write_lock_bh(callback_lock)>
It seems only TCP stack contains [C] cases, in very unlikely paths, but still...
Since all AF_INET sockets share the same af_callback_key
*and* the same af_family_slock_keys, lockdep warned Tetsuo because
it detects an UDP [A] case and a TCP [C] case.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists