tcp: fix lockdep splat in tcp_snd_una_update()
authorEric Dumazet <edumazet@google.com>
Tue, 3 May 2016 23:56:03 +0000 (16:56 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 May 2016 20:55:11 +0000 (16:55 -0400)
commit46cc6e4976e3d9058490f20d93bc7805f7f2d81e
tree5856b8bab06927f7fc934b7f07a272f5ae680d9c
parent5332174a83720921a5ef6db8080a8691f7ccbc27
tcp: fix lockdep splat in tcp_snd_una_update()

tcp_snd_una_update() and tcp_rcv_nxt_update() call
u64_stats_update_begin() either from process context or BH handler.

This triggers a lockdep splat on 32bit & SMP builds.

We could add u64_stats_update_begin_bh() variant but this would
slow down 32bit builds with useless local_disable_bh() and
local_enable_bh() pairs, since we own the socket lock at this point.

I add sock_owned_by_me() helper to have proper lockdep support
even on 64bit builds, and new u64_stats_update_begin_raw()
and u64_stats_update_end_raw methods.

Fixes: c10d9310edf5 ("tcp: do not assume TCP code is non preemptible")
Reported-by: Fabio Estevam <festevam@gmail.com>
Diagnosed-by: Francois Romieu <romieu@fr.zoreil.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Tested-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/u64_stats_sync.h
include/net/sock.h
net/ipv4/tcp_input.c