From owner-svn-src-head@freebsd.org Tue Jun 12 22:18:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9317210036AD; Tue, 12 Jun 2018 22:18:32 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2C3867CB9B; Tue, 12 Jun 2018 22:18:30 +0000 (UTC) (envelope-from mmacy@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 8552710AB3; Tue, 12 Jun 2018 22:18:28 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5CMISw2067804; Tue, 12 Jun 2018 22:18:28 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5CMIRe5067802; Tue, 12 Jun 2018 22:18:27 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201806122218.w5CMIRe5067802@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Tue, 12 Jun 2018 22:18:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335017 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 335017 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 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, 12 Jun 2018 22:18:32 -0000 Author: mmacy Date: Tue Jun 12 22:18:27 2018 New Revision: 335017 URL: https://svnweb.freebsd.org/changeset/base/335017 Log: Defer inpcbport free until after a grace period has elapsed This is a dependency for inpcbinfo rlock conversion to epoch Modified: head/sys/netinet/in_pcb.c head/sys/netinet/in_pcb.h Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Tue Jun 12 22:18:20 2018 (r335016) +++ head/sys/netinet/in_pcb.c Tue Jun 12 22:18:27 2018 (r335017) @@ -1570,6 +1570,15 @@ in_pcblist_rele_rlocked(epoch_context_t ctx) } static void +inpcbport_free(epoch_context_t ctx) +{ + struct inpcbport *phd; + + phd = __containerof(ctx, struct inpcbport, phd_epoch_ctx); + free(phd, M_PCB); +} + +static void in_pcbfree_deferred(epoch_context_t ctx) { struct inpcb *inp; @@ -1598,7 +1607,6 @@ in_pcbfree_deferred(epoch_context_t ctx) #endif if (inp->inp_options) (void)m_free(inp->inp_options); - inp->inp_vflag = 0; crfree(inp->inp_cred); #ifdef MAC @@ -1682,7 +1690,7 @@ in_pcbdrop(struct inpcb *inp) CK_LIST_REMOVE(inp, inp_portlist); if (CK_LIST_FIRST(&phd->phd_pcblist) == NULL) { CK_LIST_REMOVE(phd, phd_hash); - free(phd, M_PCB); + epoch_call(net_epoch_preempt, &phd->phd_epoch_ctx, inpcbport_free); } INP_HASH_WUNLOCK(inp->inp_pcbinfo); inp->inp_flags &= ~INP_INHASHLIST; @@ -2552,6 +2560,7 @@ in_pcbinshash_internal(struct inpcb *inp, int do_pcbgr if (phd == NULL) { return (ENOBUFS); /* XXX */ } + bzero(&phd->phd_epoch_ctx, sizeof(struct epoch_context)); phd->phd_port = inp->inp_lport; CK_LIST_INIT(&phd->phd_pcblist); CK_LIST_INSERT_HEAD(pcbporthash, phd, phd_hash); Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Tue Jun 12 22:18:20 2018 (r335016) +++ head/sys/netinet/in_pcb.h Tue Jun 12 22:18:27 2018 (r335017) @@ -402,6 +402,7 @@ void in_pcbtoxinpcb(const struct inpcb *, struct xinpc #endif /* _SYS_SOCKETVAR_H_ */ struct inpcbport { + struct epoch_context phd_epoch_ctx; CK_LIST_ENTRY(inpcbport) phd_hash; struct inpcbhead phd_pcblist; u_short phd_port;