Skip to contentSkip to conversation

tcp_close - why no WARN_ON ?

DISCUSSION Christoph Paasch 1 participant 1 message Dec 19, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

Signature · 7 lines
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
--