summaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2016-05-03 19:56:03 -0400
committerDavid S. Miller <davem@davemloft.net>2016-05-04 16:55:11 -0400
commit46cc6e4976e3d9058490f20d93bc7805f7f2d81e (patch)
tree5856b8bab06927f7fc934b7f07a272f5ae680d9c /include/net/sock.h
parent5332174a83720921a5ef6db8080a8691f7ccbc27 (diff)
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>
Diffstat (limited to 'include/net/sock.h')
-rw-r--r--include/net/sock.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 45f5b492c658..c9c8b19df27c 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1421,11 +1421,16 @@ static inline void unlock_sock_fast(struct sock *sk, bool slow)
1421 * accesses from user process context. 1421 * accesses from user process context.
1422 */ 1422 */
1423 1423
1424static inline bool sock_owned_by_user(const struct sock *sk) 1424static inline void sock_owned_by_me(const struct sock *sk)
1425{ 1425{
1426#ifdef CONFIG_LOCKDEP 1426#ifdef CONFIG_LOCKDEP
1427 WARN_ON_ONCE(!lockdep_sock_is_held(sk) && debug_locks); 1427 WARN_ON_ONCE(!lockdep_sock_is_held(sk) && debug_locks);
1428#endif 1428#endif
1429}
1430
1431static inline bool sock_owned_by_user(const struct sock *sk)
1432{
1433 sock_owned_by_me(sk);
1429 return sk->sk_lock.owned; 1434 return sk->sk_lock.owned;
1430} 1435}
1431 1436