Subject: tcp_close - why no WARN_ON ?

From: Christoph Paasch <[email-masked]>
Date: Mon, 19 Dec 2011 13:57:35 +0100

Hi all,

I am trying to understand the following code in tcp_close:

  sock_orphan(sk);

  /* It is the last release_sock in its life. It will remove backlog. */
  release_sock(sk);

  /* Now socket is owned by kernel and we acquire BH lock
     to finish close. No need to check for user refs.
   */
  local_bh_disable();
  bh_lock_sock(sk);
  WARN_ON(sock_owned_by_user(sk));

How is it possible that between release_sock(sk) and local_bh_disable(),
no other thread gets scheduled and calls lock_sock() and thus the
WARN_ON would be triggered ?

Can someone please point me to the lines of code that handle this ?

Thanks a lot,
Christoph

-- 
Christoph Paasch
PhD Student

IP Networking Lab --- http://inl.info.ucl.ac.be
MultiPath TCP in the Linux Kernel --- http://mptcp.info.ucl.ac.be
Université Catholique de Louvain
--