netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Weird locking in __release_sock()?
@ 2011-06-22 23:31 David Daney
  2011-06-22 23:42 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: David Daney @ 2011-06-22 23:31 UTC (permalink / raw)
  To: netdev

Hi,

In net/core/sock.c the function __release_sock() appears to drop the 
socket lock, and then feed the backlogged skbs to sk_backlog_rcv().


In the case of an IPv4 TCP socket, sk_backlog_rcv() calls 
tcp_v4_do_rcv(), which is documented like this:

/* The socket must have it's spinlock held when we get
  * here.
.
.
.
*/

Q: How can this be correct?

Perhaps I am missing something.  In any event, thanks in advance 
shedding some light on the locking situation.

David Daney

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Weird locking in __release_sock()?
  2011-06-22 23:31 Weird locking in __release_sock()? David Daney
@ 2011-06-22 23:42 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-06-22 23:42 UTC (permalink / raw)
  To: ddaney; +Cc: netdev

From: David Daney <ddaney@caviumnetworks.com>
Date: Wed, 22 Jun 2011 16:31:13 -0700

> In the case of an IPv4 TCP socket, sk_backlog_rcv() calls
> tcp_v4_do_rcv(), which is documented like this:
> 
> /* The socket must have it's spinlock held when we get
>  * here.
> .
> .
> .
> */
> 
> Q: How can this be correct?

sk->lock.owned will be "1" while the backlog is processed.

Exclusive access to the socket is indicated by one of the
following two conditions being true:

1) sk->lock.slock being held
2) sk->lock.owned being non-zero

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-06-22 23:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-22 23:31 Weird locking in __release_sock()? David Daney
2011-06-22 23:42 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).