Tue Apr 14 04:44:41 2015 UTC ()
Pull up following revision(s) (requested by christos in ticket #678):
	sys/kern/uipc_usrreq.c: revision 1.175
PR/39918: ITOH Yasufumi: Replace KASSERT with continue, since the file
descriptor can be closed since closef() does not pay attention to FDEFER.
XXX: Pullup-7


(snj)
diff -r1.169.2.2 -r1.169.2.3 src/sys/kern/uipc_usrreq.c

cvs diff -r1.169.2.2 -r1.169.2.3 src/sys/kern/uipc_usrreq.c (expand / switch to unified diff)

--- src/sys/kern/uipc_usrreq.c 2015/02/04 06:29:07 1.169.2.2
+++ src/sys/kern/uipc_usrreq.c 2015/04/14 04:44:41 1.169.2.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: uipc_usrreq.c,v 1.169.2.2 2015/02/04 06:29:07 snj Exp $ */ 1/* $NetBSD: uipc_usrreq.c,v 1.169.2.3 2015/04/14 04:44:41 snj Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center, and by Andrew Doran. 9 * NASA Ames Research Center, and by Andrew Doran.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -86,27 +86,27 @@ @@ -86,27 +86,27 @@
86 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 86 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
87 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 87 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
88 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 88 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
89 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 89 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
90 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 90 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
91 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 91 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
92 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 92 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
93 * SUCH DAMAGE. 93 * SUCH DAMAGE.
94 * 94 *
95 * @(#)uipc_usrreq.c 8.9 (Berkeley) 5/14/95 95 * @(#)uipc_usrreq.c 8.9 (Berkeley) 5/14/95
96 */ 96 */
97 97
98#include <sys/cdefs.h> 98#include <sys/cdefs.h>
99__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.169.2.2 2015/02/04 06:29:07 snj Exp $"); 99__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.169.2.3 2015/04/14 04:44:41 snj Exp $");
100 100
101#include <sys/param.h> 101#include <sys/param.h>
102#include <sys/systm.h> 102#include <sys/systm.h>
103#include <sys/proc.h> 103#include <sys/proc.h>
104#include <sys/filedesc.h> 104#include <sys/filedesc.h>
105#include <sys/domain.h> 105#include <sys/domain.h>
106#include <sys/protosw.h> 106#include <sys/protosw.h>
107#include <sys/socket.h> 107#include <sys/socket.h>
108#include <sys/socketvar.h> 108#include <sys/socketvar.h>
109#include <sys/unpcb.h> 109#include <sys/unpcb.h>
110#include <sys/un.h> 110#include <sys/un.h>
111#include <sys/namei.h> 111#include <sys/namei.h>
112#include <sys/vnode.h> 112#include <sys/vnode.h>
@@ -1700,27 +1700,34 @@ unp_gc(file_t *dp) @@ -1700,27 +1700,34 @@ unp_gc(file_t *dp)
1700 * sockets which are queued on a socket. Recan continues descending 1700 * sockets which are queued on a socket. Recan continues descending
1701 * and searching for sockets referenced by sockets (FDEFER), until 1701 * and searching for sockets referenced by sockets (FDEFER), until
1702 * there are no more socket->socket references to be discovered. 1702 * there are no more socket->socket references to be discovered.
1703 */ 1703 */
1704 do { 1704 do {
1705 didwork = false; 1705 didwork = false;
1706 for (fp = LIST_FIRST(&filehead); fp != NULL; fp = np) { 1706 for (fp = LIST_FIRST(&filehead); fp != NULL; fp = np) {
1707 KASSERT(mutex_owned(&filelist_lock)); 1707 KASSERT(mutex_owned(&filelist_lock));
1708 np = LIST_NEXT(fp, f_list); 1708 np = LIST_NEXT(fp, f_list);
1709 mutex_enter(&fp->f_lock); 1709 mutex_enter(&fp->f_lock);
1710 if ((fp->f_flag & FDEFER) != 0) { 1710 if ((fp->f_flag & FDEFER) != 0) {
1711 atomic_and_uint(&fp->f_flag, ~FDEFER); 1711 atomic_and_uint(&fp->f_flag, ~FDEFER);
1712 unp_defer--; 1712 unp_defer--;
1713 KASSERT(fp->f_count != 0); 1713 if (fp->f_count == 0) {
 1714 /*
 1715 * XXX: closef() doesn't pay attention
 1716 * to FDEFER
 1717 */
 1718 mutex_exit(&fp->f_lock);
 1719 continue;
 1720 }
1714 } else { 1721 } else {
1715 if (fp->f_count == 0 || 1722 if (fp->f_count == 0 ||
1716 (fp->f_flag & FMARK) != 0 || 1723 (fp->f_flag & FMARK) != 0 ||
1717 fp->f_count == fp->f_msgcount || 1724 fp->f_count == fp->f_msgcount ||
1718 fp->f_unpcount != 0) { 1725 fp->f_unpcount != 0) {
1719 mutex_exit(&fp->f_lock); 1726 mutex_exit(&fp->f_lock);
1720 continue; 1727 continue;
1721 } 1728 }
1722 } 1729 }
1723 atomic_or_uint(&fp->f_flag, FMARK); 1730 atomic_or_uint(&fp->f_flag, FMARK);
1724 1731
1725 if (fp->f_type != DTYPE_SOCKET || 1732 if (fp->f_type != DTYPE_SOCKET ||
1726 (so = fp->f_data) == NULL || 1733 (so = fp->f_data) == NULL ||