From owner-svn-src-all@freebsd.org Thu Nov 7 21:28:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 378D817A210; Thu, 7 Nov 2019 21:28:47 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Gjq0kZCz4Nc5; Thu, 7 Nov 2019 21:28:47 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F08D01BFF3; Thu, 7 Nov 2019 21:28:46 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7LSkU4096586; Thu, 7 Nov 2019 21:28:46 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7LSknp096585; Thu, 7 Nov 2019 21:28:46 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911072128.xA7LSknp096585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 21:28:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354485 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 354485 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 21:28:47 -0000 Author: glebius Date: Thu Nov 7 21:28:46 2019 New Revision: 354485 URL: https://svnweb.freebsd.org/changeset/base/354485 Log: Since pfslowtimo() runs in the network epoch, tcp_slowtimo() also does. This allows to simplify tcp_tw_2msl_scan() and always require the network epoch in it. Modified: head/sys/netinet/tcp_timewait.c Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Thu Nov 7 21:27:32 2019 (r354484) +++ head/sys/netinet/tcp_timewait.c Thu Nov 7 21:28:46 2019 (r354485) @@ -689,25 +689,8 @@ tcp_tw_2msl_scan(int reuse) { struct tcptw *tw; struct inpcb *inp; - struct epoch_tracker et; -#ifdef INVARIANTS - if (reuse) { - /* - * Exclusive pcbinfo lock is not required in reuse case even if - * two inpcb locks can be acquired simultaneously: - * - the inpcb transitioning to TIME_WAIT state in - * tcp_tw_start(), - * - the inpcb closed by tcp_twclose(). - * - * It is because only inpcbs in FIN_WAIT2 or CLOSING states can - * transition in TIME_WAIT state. Then a pcbcb cannot be in - * TIME_WAIT list and transitioning to TIME_WAIT state at same - * time. - */ - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); - } -#endif + NET_EPOCH_ASSERT(); for (;;) { TW_RLOCK(V_tw_lock); @@ -723,12 +706,10 @@ tcp_tw_2msl_scan(int reuse) in_pcbref(inp); TW_RUNLOCK(V_tw_lock); - INP_INFO_RLOCK_ET(&V_tcbinfo, et); INP_WLOCK(inp); tw = intotw(inp); if (in_pcbrele_wlocked(inp)) { if (__predict_true(tw == NULL)) { - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); continue; } else { /* This should not happen as in TIMEWAIT @@ -747,7 +728,6 @@ tcp_tw_2msl_scan(int reuse) "|| inp last reference) && tw != " "NULL", __func__); #endif - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); break; } } @@ -755,12 +735,10 @@ tcp_tw_2msl_scan(int reuse) if (tw == NULL) { /* tcp_twclose() has already been called */ INP_WUNLOCK(inp); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); continue; } tcp_twclose(tw, reuse); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); if (reuse) return tw; }