From owner-svn-src-user@FreeBSD.ORG Tue May 19 04:47:31 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 476C71065670; Tue, 19 May 2009 04:47:31 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C17E8FC15; Tue, 19 May 2009 04:47:31 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4J4lVDV085320; Tue, 19 May 2009 04:47:31 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4J4lVY0085319; Tue, 19 May 2009 04:47:31 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905190447.n4J4lVY0085319@svn.freebsd.org> From: Kip Macy Date: Tue, 19 May 2009 04:47:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192370 - user/kmacy/releng_7_2_fcs/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 May 2009 04:47:31 -0000 Author: kmacy Date: Tue May 19 04:47:30 2009 New Revision: 192370 URL: http://svn.freebsd.org/changeset/base/192370 Log: merge 175026,175211,175212 - Place the fhold() in unp_internalize_fp to be more consistent with refs. - Clear all of the gc flags before doing a run. Stale flags were causing us to skip some descriptors. - If a unp socket has been marked REF in a gc pass it can't be dead. Found by: rwatson's test tool. Correct typos in comments. MFC after: 3 weeks Remove "lock pushdown" todo item in comment -- I did that for 7.0. MFC after: 3 weeks Modified: user/kmacy/releng_7_2_fcs/sys/kern/uipc_usrreq.c Modified: user/kmacy/releng_7_2_fcs/sys/kern/uipc_usrreq.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/kern/uipc_usrreq.c Tue May 19 04:43:00 2009 (r192369) +++ user/kmacy/releng_7_2_fcs/sys/kern/uipc_usrreq.c Tue May 19 04:47:30 2009 (r192370) @@ -1763,7 +1763,6 @@ unp_internalize(struct mbuf **controlp, for (i = 0; i < oldfds; i++) { fp = fdescp->fd_ofiles[*fdp++]; *rp++ = fp; - fhold(fp); unp_internalize_fp(fp); } FILEDESC_SUNLOCK(fdescp); @@ -1883,6 +1882,7 @@ unp_internalize_fp(struct file *fp) unp->unp_file = fp; unp->unp_msgcount++; } + fhold(fp); unp_rights++; UNP_GLOBAL_WUNLOCK(); } @@ -1912,8 +1912,7 @@ unp_accessable(struct file *fp) { struct unpcb *unp; - unp = fptounp(fp); - if (fp == NULL) + if ((unp = fptounp(fp)) == NULL) return; if (unp->unp_gcflag & UNPGC_REF) return; @@ -1938,8 +1937,8 @@ unp_gc_process(struct unpcb *unp) * queue as indicated by msgcount, and this must equal the file * reference count. Note that when msgcount is 0 the file is NULL. */ - if (unp->unp_msgcount != 0 && fp->f_count != 0 && - fp->f_count == unp->unp_msgcount) { + if ((unp->unp_gcflag & UNPGC_REF) == 0 && fp && + unp->unp_msgcount != 0 && fp->f_count == unp->unp_msgcount) { unp->unp_gcflag |= UNPGC_DEAD; unp_unreachable++; return; @@ -1987,7 +1986,7 @@ unp_gc(__unused void *arg, int pending) */ for (head = heads; *head != NULL; head++) LIST_FOREACH(unp, *head, unp_link) - unp->unp_gcflag &= ~(UNPGC_REF|UNPGC_DEAD); + unp->unp_gcflag = 0; /* * Scan marking all reachable sockets with UNPGC_REF. Once a socket * is reachable all of the sockets it references are reachable. @@ -2018,6 +2017,7 @@ unp_gc(__unused void *arg, int pending) LIST_FOREACH(unp, *head, unp_link) if (unp->unp_gcflag & UNPGC_DEAD) { unref[i++] = unp->unp_file; + fhold(unp->unp_file); KASSERT(unp->unp_file != NULL, ("unp_gc: Invalid unpcb.")); KASSERT(i <= unp_unreachable, @@ -2026,13 +2026,6 @@ unp_gc(__unused void *arg, int pending) UNP_GLOBAL_RUNLOCK(); /* - * All further operation is now done on a local list. We first ref - * all sockets to avoid closing them until all are flushed. - */ - for (i = 0; i < unp_unreachable; i++) - fhold(unref[i]); - - /* * Now flush all sockets, free'ing rights. This will free the * struct files associated with these sockets but leave each socket * with one remaining ref.