On 05/06/18(Tue) 11:28, Martin Pieuchot wrote:
> On 04/06/18(Mon) 21:11, Claudio Jeker wrote:
> > On Mon, Jun 04, 2018 at 03:25:17PM +0200, Martin Pieuchot wrote:
> > > For pfkey and routing sockets, calling sofree() in pr_detach is a noop.
> > > The reason is that `SS_NOFDREF' hasn't been set at this point so the
> > > socket won't be freed.
> > > 
> > > So I'd like to remove the sofree() and add an assert instead.  sofree()
> > > will need to change soon to be able to deal with per-socket locks as
> > > well as global locks.  So having fewer of them help.
> > > 
> > > ok?
> > 
> > I'm not sure if I like it when implementations differ in use of the socket
> > functions. In general I would prefer if the socket interface is used the
> > same way by all protocols so that reviewing them is simpler.
> > I understand that the mentioned ones are already kind of special
> > snowflakes so maybe this is not an issue.
> 
> Could you please read my "Towards per-socket locks" diff?  No matter
> which way we go the implementation will differ because we're using
> different locks.  I'm trying to keep the number of lock-related hacks
> low.

To put it differently, the protocol layer doesn't have to free the
socket, actually it almost never do it.  The exception is in tcp_input()
when a RST is sent.

I believe my change makes sense because pr_detach() does what its name
says: it detach the pcb from the socket.  pr_detach() is called from
soclose() which will free the socket.

Trying the generalize the TCP exception doesn't make sense to me.

Reply via email to