From owner-svn-src-head@freebsd.org Tue Aug 16 13:14:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49B58BBB07B for ; Tue, 16 Aug 2016 13:14:47 +0000 (UTC) (envelope-from rrs@netflix.com) Received: from mail-pf0-x231.google.com (mail-pf0-x231.google.com [IPv6:2607:f8b0:400e:c00::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1ACBC1BE8 for ; Tue, 16 Aug 2016 13:14:47 +0000 (UTC) (envelope-from rrs@netflix.com) Received: by mail-pf0-x231.google.com with SMTP id y134so27665770pfg.0 for ; Tue, 16 Aug 2016 06:14:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netflix.com; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=IZjI1JC58ckslmgn+ZQ9AmzqRpmCrBDhpjRRvgVkh8Y=; b=alfbdIoH7uHheqVaKgQ6mLM7GLT0VAG7omH/C8eHWdN36HexblTzYplAFxfzRU6siV 6e2caOYlX1CLwmjcay0oXUNNM/yMVw8WQBhvyP05gYhSe0TRw7zOXkpZtI7GWwuwp+ZY BZhpOoKMIb9pA2DPB40X0u1KymVY9DcXDwXzE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=IZjI1JC58ckslmgn+ZQ9AmzqRpmCrBDhpjRRvgVkh8Y=; b=WBx8Zz1lHAELzzywNRnDtlSVitsVAjmcMHEf0AZ0vwVu6yG9owH9gkKvpoxt2cnUf2 yBhhKBi59CudetrWy3uNzH6V0hExQjVuEzR+nSRWQZ/bdL/ALBONYVm72EjHs9piy0/H Y7hDUHukA8hP36fAemu9pv4iGpS0C3CWxk7RtnF7fRDrpoEEOfNVceSzd2v9ncdGBSky c+qB+46OgsxTMGB3ehsSSbfWudz85ghr419pDtC1pFn6qnSpjX3hWGYpIkEdz75YGkaE OejZiiRrHLRWOzMqNAoKg6IfDo/hmMHojaH45t83evtJJRE+/B/NlNUfwpja/HHTKyxB zD8A== X-Gm-Message-State: AEkoouvAyprX/tfwXQnNl1WiwBE4B7mUJ6nnjIIIodZmxSqB91hNhWgPEkiPH0IK2nVJz6p7 X-Received: by 10.98.58.73 with SMTP id h70mr63305000pfa.125.1471353286521; Tue, 16 Aug 2016 06:14:46 -0700 (PDT) Received: from [100.127.65.50] ([69.53.245.200]) by smtp.gmail.com with ESMTPSA id s12sm39369097pfj.73.2016.08.16.06.14.45 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Aug 2016 06:14:45 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r304218 - head/sys/netinet From: Randall Stewart In-Reply-To: <61c62080-1529-a717-fbfc-4f4baed56c3e@selasky.org> Date: Tue, 16 Aug 2016 06:14:44 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <6BDE71C4-7C3C-4025-8D49-A87BF65CBFEE@netflix.com> 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> To: Hans Petter Selasky X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 13:14:47 -0000 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 = 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