Weird locking in __release_sock()?
Subsystems (2)
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
David Miller
maintainerFrom: David Daney <[email protected]>
Date: Wed, 22 Jun 2011 16:31:13 -0700
Quoted 11 lines
In the case of an IPv4 TCP socket,
sk_backlog_rcv()callstcp_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