Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Aug 2016 06:14:44 -0700
From:      Randall Stewart <rrs@netflix.com>
To:        Hans Petter Selasky <hps@selasky.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r304218 - head/sys/netinet
Message-ID:  <6BDE71C4-7C3C-4025-8D49-A87BF65CBFEE@netflix.com>
In-Reply-To: <61c62080-1529-a717-fbfc-4f4baed56c3e@selasky.org>
References:  <201608161240.u7GCeuWS082118@repo.freebsd.org> <92a3cfc1-56bc-813f-dd12-ac19c66fd716@selasky.org> <272AD783-2988-4EE7-89A5-EC6FA1313122@netflix.com> <61c62080-1529-a717-fbfc-4f4baed56c3e@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hans:

Take a look at the comments maybe they will help you understand whats =
going on.

The idea of it is that you *only* need the INFO_RLOCK when the timer =
function
wants to destroy the tcb (not all timers do this).. and yes usually the =
timer function
is going to call the drop/close path to purge the TCB. So in order to =
pick-up the info
lock you do the refcnt/lock-dance to get both locks in the proper lock =
order. This means
that someone could possibly come in and purge the tcb on you while you =
are in the
process of doing the lock-dance.=20

If that occurs (the return code is 1) all the caller has to do is call =
the drop-lock function (the
mate to the add_lock) and then return (since the pcb is in the state the =
caller wants.. i.e. gone).
If the return code is 0, the caller can proceed to purge the tcb.. and =
then call the drop_lock function.

Note that in theory this could be used outside of wanting to kill the =
tcb.. but I am not sure why one
would want to hold the INFO_RLOCK if one did not want to purge the tcb.

R


> On Aug 16, 2016, at 6:14 AM, Hans Petter Selasky <hps@selasky.org> =
wrote:
>=20
> On 08/16/16 15:01, Randall Stewart wrote:
>> Sure
>>=20
>> Let me add some comments for you. The idea her is that you pick-up a =
reference
>> to the PCB.. so it can=E2=80=99t be removed. Thus when you re-lock =
the INP you check the
>> dropped flag (just in case someone did get in).
>=20
> And this code is only used before tcp_close() / tcp_drop(), so if =
others got in it is safe to assume that the inp is dead?
>=20
> --HPS

--------
Randall Stewart
rrs@netflix.com
803-317-4952








Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6BDE71C4-7C3C-4025-8D49-A87BF65CBFEE>