Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jun 2002 23:14:09 -0700 (PDT)
From:      Julian Elischer <julian@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 12877 for review
Message-ID:  <200206140614.g5E6E9S88373@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=12877

Change 12877 by julian@julian_jules1 on 2002/06/13 23:13:31

	Desperatly chase -current

Affected files ...

... //depot/projects/kse/sys/conf/files#37 integrate
... //depot/projects/kse/sys/conf/files.i386#23 integrate
... //depot/projects/kse/sys/conf/files.pc98#25 integrate
... //depot/projects/kse/sys/conf/options#19 integrate
... //depot/projects/kse/sys/dev/pccbb/pccbb.c#17 integrate
... //depot/projects/kse/sys/dev/pccbb/pccbbvar.h#6 integrate
... //depot/projects/kse/sys/fs/nullfs/null.h#3 integrate
... //depot/projects/kse/sys/fs/nullfs/null_subr.c#4 integrate
... //depot/projects/kse/sys/fs/nullfs/null_vfsops.c#6 integrate
... //depot/projects/kse/sys/fs/nullfs/null_vnops.c#8 integrate
... //depot/projects/kse/sys/i4b/capi/iavc/iavc_card.c#2 integrate
... //depot/projects/kse/sys/i4b/capi/iavc/iavc_lli.c#3 integrate
... //depot/projects/kse/sys/i4b/capi/iavc/iavc_pci.c#5 integrate
... //depot/projects/kse/sys/i4b/layer1/ifpi/i4b_ifpi_isac.c#2 integrate
... //depot/projects/kse/sys/i4b/layer1/ifpi/i4b_ifpi_l1.c#2 integrate
... //depot/projects/kse/sys/i4b/layer1/ifpi/i4b_ifpi_l1fsm.c#2 integrate
... //depot/projects/kse/sys/i4b/layer1/ifpi/i4b_ifpi_pci.c#4 integrate
... //depot/projects/kse/sys/i4b/layer1/ifpi2/i4b_ifpi2_isacsx.c#2 integrate
... //depot/projects/kse/sys/i4b/layer1/ifpi2/i4b_ifpi2_l1.c#3 integrate
... //depot/projects/kse/sys/i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c#2 integrate
... //depot/projects/kse/sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c#6 integrate
... //depot/projects/kse/sys/i4b/layer1/isic/i4b_elsa_qs1p.c#2 integrate
... //depot/projects/kse/sys/i4b/layer1/itjc/i4b_itjc_isac.c#2 integrate
... //depot/projects/kse/sys/i4b/layer1/itjc/i4b_itjc_l1.c#2 integrate
... //depot/projects/kse/sys/i4b/layer1/itjc/i4b_itjc_l1fsm.c#2 integrate
... //depot/projects/kse/sys/i4b/layer1/itjc/i4b_itjc_pci.c#3 integrate
... //depot/projects/kse/sys/i4b/layer1/iwic/i4b_iwic_bchan.c#4 integrate
... //depot/projects/kse/sys/i4b/layer1/iwic/i4b_iwic_dchan.c#2 integrate
... //depot/projects/kse/sys/i4b/layer1/iwic/i4b_iwic_fsm.c#2 integrate
... //depot/projects/kse/sys/i4b/layer1/iwic/i4b_iwic_l1if.c#2 integrate
... //depot/projects/kse/sys/i4b/layer1/iwic/i4b_iwic_pci.c#2 integrate
... //depot/projects/kse/sys/kern/init_sysent.c#20 integrate
... //depot/projects/kse/sys/kern/kern_acl.c#15 integrate
... //depot/projects/kse/sys/kern/kern_cap.c#7 delete
... //depot/projects/kse/sys/kern/subr_mbuf.c#12 integrate
... //depot/projects/kse/sys/kern/syscalls.c#20 integrate
... //depot/projects/kse/sys/kern/syscalls.master#19 integrate
... //depot/projects/kse/sys/netatm/uni/sscf_uni.c#4 integrate
... //depot/projects/kse/sys/netatm/uni/sscf_uni_lower.c#2 integrate
... //depot/projects/kse/sys/netatm/uni/sscop.c#4 integrate
... //depot/projects/kse/sys/netatm/uni/sscop_lower.c#3 integrate
... //depot/projects/kse/sys/netatm/uni/sscop_var.h#3 integrate
... //depot/projects/kse/sys/netatm/uni/uniarp.c#4 integrate
... //depot/projects/kse/sys/netatm/uni/uniarp_cache.c#3 integrate
... //depot/projects/kse/sys/netatm/uni/uniarp_timer.c#3 integrate
... //depot/projects/kse/sys/netatm/uni/uniarp_vcm.c#2 integrate
... //depot/projects/kse/sys/netatm/uni/uniip.c#4 integrate
... //depot/projects/kse/sys/netatm/uni/uniip_var.h#3 integrate
... //depot/projects/kse/sys/netatm/uni/unisig_decode.c#4 integrate
... //depot/projects/kse/sys/netatm/uni/unisig_if.c#4 integrate
... //depot/projects/kse/sys/netatm/uni/unisig_msg.c#3 integrate
... //depot/projects/kse/sys/netatm/uni/unisig_subr.c#3 integrate
... //depot/projects/kse/sys/netatm/uni/unisig_util.c#3 integrate
... //depot/projects/kse/sys/netatm/uni/unisig_var.h#3 integrate
... //depot/projects/kse/sys/netatm/uni/unisig_vc_state.c#4 integrate
... //depot/projects/kse/sys/netinet/tcp_output.c#8 integrate
... //depot/projects/kse/sys/netinet/tcp_syncache.c#17 integrate
... //depot/projects/kse/sys/netinet/tcp_usrreq.c#11 integrate
... //depot/projects/kse/sys/netinet/tcp_var.h#9 integrate
... //depot/projects/kse/sys/pccard/pcic_pci.c#24 integrate
... //depot/projects/kse/sys/sparc64/pci/ofw_pci.c#4 integrate
... //depot/projects/kse/sys/sparc64/pci/ofw_pci.h#3 integrate
... //depot/projects/kse/sys/sparc64/pci/psycho.c#7 integrate
... //depot/projects/kse/sys/sparc64/pci/psychoreg.h#4 integrate
... //depot/projects/kse/sys/sys/capability.h#9 delete
... //depot/projects/kse/sys/sys/syscall.h#20 integrate
... //depot/projects/kse/sys/sys/syscall.mk#20 integrate
... //depot/projects/kse/sys/sys/sysproto.h#24 integrate

Differences ...

==== //depot/projects/kse/sys/conf/files#37 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.646 2002/06/10 18:49:37 phk Exp $
+# $FreeBSD: src/sys/conf/files,v 1.648 2002/06/13 23:19:34 rwatson Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -774,7 +774,7 @@
 #
 # isdn4bsd AVM B1/T1 CAPI driver
 #
-i4b/capi/iavc/iavc_pci.c	count iavc
+i4b/capi/iavc/iavc_pci.c	count iavc pci
 i4b/capi/iavc/iavc_isa.c	optional iavc
 i4b/capi/iavc/iavc_lli.c	optional iavc
 i4b/capi/iavc/iavc_card.c	optional iavc
@@ -831,7 +831,6 @@
 kern/init_sysent.c	standard
 kern/kern_acct.c	standard
 kern/kern_acl.c		standard
-kern/kern_cap.c		standard
 kern/kern_clock.c	standard
 kern/kern_condvar.c	standard
 kern/kern_conf.c	standard

==== //depot/projects/kse/sys/conf/files.i386#23 (text+ko) ====

@@ -1,7 +1,7 @@
 # This file tells config what files go into building a kernel,
 # files marked standard are always included.
 #
-# $FreeBSD: src/sys/conf/files.i386,v 1.401 2002/06/03 22:30:35 pdeuskar Exp $
+# $FreeBSD: src/sys/conf/files.i386,v 1.402 2002/06/13 06:04:25 brooks Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -338,7 +338,7 @@
 i4b/layer1/isic/i4b_drn_ngo.c		optional	isic
 i4b/layer1/isic/i4b_dynalink.c		optional	isic
 i4b/layer1/isic/i4b_elsa_qs1i.c		optional	isic
-i4b/layer1/isic/i4b_elsa_qs1p.c		optional	isic
+i4b/layer1/isic/i4b_elsa_qs1p.c		optional	isic pci
 i4b/layer1/isic/i4b_elsa_pcc16.c	optional	isic
 i4b/layer1/isic/i4b_hscx.c		optional	isic
 i4b/layer1/isic/i4b_isac.c		optional	isic
@@ -358,25 +358,25 @@
 #
 # isdn4bsd, iwic
 #
-i4b/layer1/iwic/i4b_iwic_pci.c		count		iwic
-i4b/layer1/iwic/i4b_iwic_dchan.c	optional	iwic
-i4b/layer1/iwic/i4b_iwic_bchan.c	optional	iwic
-i4b/layer1/iwic/i4b_iwic_fsm.c		optional	iwic
-i4b/layer1/iwic/i4b_iwic_l1if.c		optional	iwic
+i4b/layer1/iwic/i4b_iwic_pci.c		count		iwic pci
+i4b/layer1/iwic/i4b_iwic_dchan.c	optional	iwic pci
+i4b/layer1/iwic/i4b_iwic_bchan.c	optional	iwic pci
+i4b/layer1/iwic/i4b_iwic_fsm.c		optional	iwic pci
+i4b/layer1/iwic/i4b_iwic_l1if.c		optional	iwic pci
 #
 # isdn4bsd, ifpi
 #
-i4b/layer1/ifpi/i4b_ifpi_pci.c		count		ifpi
-i4b/layer1/ifpi/i4b_ifpi_isac.c		optional	ifpi
-i4b/layer1/ifpi/i4b_ifpi_l1.c		optional	ifpi
-i4b/layer1/ifpi/i4b_ifpi_l1fsm.c	optional	ifpi
+i4b/layer1/ifpi/i4b_ifpi_pci.c		count		ifpi pci
+i4b/layer1/ifpi/i4b_ifpi_isac.c		optional	ifpi pci
+i4b/layer1/ifpi/i4b_ifpi_l1.c		optional	ifpi pci
+i4b/layer1/ifpi/i4b_ifpi_l1fsm.c	optional	ifpi pci
 #
 # isdn4bsd, ifpi2
 #
-i4b/layer1/ifpi2/i4b_ifpi2_pci.c	count		ifpi2
-i4b/layer1/ifpi2/i4b_ifpi2_isacsx.c	optional	ifpi2
-i4b/layer1/ifpi2/i4b_ifpi2_l1.c		optional	ifpi2
-i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c	optional	ifpi2
+i4b/layer1/ifpi2/i4b_ifpi2_pci.c	count		ifpi2 pci
+i4b/layer1/ifpi2/i4b_ifpi2_isacsx.c	optional	ifpi2 pci
+i4b/layer1/ifpi2/i4b_ifpi2_l1.c		optional	ifpi2 pci
+i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c	optional	ifpi2 pci
 #
 # isdn4bsd, ifpnp
 #

==== //depot/projects/kse/sys/conf/files.pc98#25 (text+ko) ====

@@ -3,7 +3,7 @@
 #
 # modified for PC-9801
 #
-# $FreeBSD: src/sys/conf/files.pc98,v 1.233 2002/06/03 22:30:35 pdeuskar Exp $
+# $FreeBSD: src/sys/conf/files.pc98,v 1.234 2002/06/13 06:04:25 brooks Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -308,7 +308,7 @@
 i4b/layer1/isic/i4b_drn_ngo.c		optional	isic
 i4b/layer1/isic/i4b_dynalink.c		optional	isic
 i4b/layer1/isic/i4b_elsa_qs1i.c		optional	isic
-i4b/layer1/isic/i4b_elsa_qs1p.c		optional	isic
+i4b/layer1/isic/i4b_elsa_qs1p.c		optional	isic pci
 i4b/layer1/isic/i4b_elsa_pcc16.c	optional	isic
 i4b/layer1/isic/i4b_hscx.c		optional	isic
 i4b/layer1/isic/i4b_isac.c		optional	isic
@@ -328,25 +328,25 @@
 #
 # isdn4bsd, iwic
 #
-i4b/layer1/iwic/i4b_iwic_pci.c		count		iwic
-i4b/layer1/iwic/i4b_iwic_dchan.c	optional	iwic
-i4b/layer1/iwic/i4b_iwic_bchan.c	optional	iwic
-i4b/layer1/iwic/i4b_iwic_fsm.c		optional	iwic
-i4b/layer1/iwic/i4b_iwic_l1if.c		optional	iwic
+i4b/layer1/iwic/i4b_iwic_pci.c		count		iwic pci
+i4b/layer1/iwic/i4b_iwic_dchan.c	optional	iwic pci
+i4b/layer1/iwic/i4b_iwic_bchan.c	optional	iwic pci
+i4b/layer1/iwic/i4b_iwic_fsm.c		optional	iwic pci
+i4b/layer1/iwic/i4b_iwic_l1if.c		optional	iwic pci
 #
 # isdn4bsd, ifpi
 #
-i4b/layer1/ifpi/i4b_ifpi_pci.c		count		ifpi
-i4b/layer1/ifpi/i4b_ifpi_isac.c		optional	ifpi
-i4b/layer1/ifpi/i4b_ifpi_l1.c		optional	ifpi
-i4b/layer1/ifpi/i4b_ifpi_l1fsm.c	optional	ifpi
+i4b/layer1/ifpi/i4b_ifpi_pci.c		count		ifpi pci
+i4b/layer1/ifpi/i4b_ifpi_isac.c		optional	ifpi pci
+i4b/layer1/ifpi/i4b_ifpi_l1.c		optional	ifpi pci
+i4b/layer1/ifpi/i4b_ifpi_l1fsm.c	optional	ifpi pci
 #
 # isdn4bsd, ifpi2
 #
-i4b/layer1/ifpi2/i4b_ifpi2_pci.c	count		ifpi2
-i4b/layer1/ifpi2/i4b_ifpi2_isacsx.c	optional	ifpi2
-i4b/layer1/ifpi2/i4b_ifpi2_l1.c		optional	ifpi2
-i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c	optional	ifpi2
+i4b/layer1/ifpi2/i4b_ifpi2_pci.c	count		ifpi2 pci
+i4b/layer1/ifpi2/i4b_ifpi2_isacsx.c	optional	ifpi2 pci
+i4b/layer1/ifpi2/i4b_ifpi2_l1.c		optional	ifpi2 pci
+i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c	optional	ifpi2 pci
 #
 # isdn4bsd, ifpnp
 #

==== //depot/projects/kse/sys/conf/options#19 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/options,v 1.324 2002/06/10 18:49:38 phk Exp $
+# $FreeBSD: src/sys/conf/options,v 1.325 2002/06/13 22:41:23 rwatson Exp $
 #
 #        On the handling of kernel options
 #
@@ -115,7 +115,6 @@
 _KPOSIX_VERSION			opt_posix.h
 
 # TrustedBSD and POSIX.1e Kernel Options
-CAPABILITIES	opt_cap.h
 
 # Do we want the config file compiled into the kernel?
 INCLUDE_CONFIG_FILE	opt_config.h

==== //depot/projects/kse/sys/dev/pccbb/pccbb.c#17 (text+ko) ====

@@ -25,7 +25,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/pccbb/pccbb.c,v 1.46 2002/05/30 17:37:44 takawata Exp $
+ * $FreeBSD: src/sys/dev/pccbb/pccbb.c,v 1.47 2002/06/13 07:19:31 imp Exp $
  */
 
 /*
@@ -75,6 +75,8 @@
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/condvar.h>
 #include <sys/errno.h>
 #include <sys/kernel.h>
 #include <sys/lock.h>
@@ -558,6 +560,7 @@
 	uint32_t sockbase;
 
 	mtx_init(&sc->mtx, device_get_nameunit(brdev), "pccbb", MTX_DEF);
+	cv_init(&sc->cv, "pccbb cv");
 	sc->chipset = pccbb_chipset(pci_get_devid(brdev), NULL);
 	sc->dev = brdev;
 	sc->cbdev = NULL;
@@ -599,6 +602,7 @@
 				device_printf(brdev,
 				    "Could not grab register memory\n");
 				mtx_destroy(&sc->mtx);
+				cv_destroy(&sc->cv);
 				return (ENOMEM);
 			}
 			pci_write_config(brdev, CBBR_SOCKBASE,
@@ -608,6 +612,7 @@
 		} else {
 			device_printf(brdev, "Could not map register memory\n");
 			mtx_destroy(&sc->mtx);
+			cv_destroy(&sc->cv);
 			return (ENOMEM);
 		}
 	}
@@ -644,6 +649,7 @@
 		bus_release_resource(brdev, SYS_RES_MEMORY, CBBR_SOCKBASE,
 		    sc->base_res);
 		mtx_destroy(&sc->mtx);
+		cv_destroy(&sc->cv);
 		return (ENOMEM);
 	}
 
@@ -654,6 +660,7 @@
 		bus_release_resource(brdev, SYS_RES_MEMORY, CBBR_SOCKBASE,
 		    sc->base_res);
 		mtx_destroy(&sc->mtx);
+		cv_destroy(&sc->cv);
 		return (ENOMEM);
 	}
 
@@ -715,6 +722,7 @@
 	bus_release_resource(brdev, SYS_RES_MEMORY, CBBR_SOCKBASE,
 	    sc->base_res);
 	mtx_destroy(&sc->mtx);
+	cv_destroy(&sc->cv);
 	return (0);
 }
 
@@ -888,7 +896,6 @@
 		 * if there's a card already inserted, we do the
 		 * right thing.
 		 */
-		mtx_lock(&sc->mtx);
 		if (sc->flags & PCCBB_KTHREAD_DONE)
 			break;
 
@@ -897,19 +904,19 @@
 			pccbb_insert(sc);
 		else
 			pccbb_removal(sc);
-		mtx_unlock(&sc->mtx);
 		/*
 		 * Wait until it has been 1s since the last time we
 		 * get an interrupt.  We handle the rest of the interrupt
 		 * at the top of the loop.
 		 */
-		tsleep (sc, PWAIT, "pccbbev", 0);
+		mtx_lock(&sc->mtx);
+		cv_wait(&sc->cv, &sc->mtx);
 		do {
-			err = tsleep (sc, PWAIT, "pccbbev", 1 * hz);
+			err = cv_timedwait(&sc->cv, &sc->mtx, 1 * hz);
 		} while (err != EWOULDBLOCK &&
 		    (sc->flags & PCCBB_KTHREAD_DONE) == 0);
+		mtx_unlock(&sc->mtx);
 	}
-	mtx_unlock(&sc->mtx);
 	sc->flags &= ~PCCBB_KTHREAD_RUNNING;
 	/*
 	 * XXX I think there's a race here.  If we wakeup in the other
@@ -1008,7 +1015,7 @@
 
 		if (sockevent & CBB_SOCKET_EVENT_CD) {
 			mtx_lock(&sc->mtx);
-			wakeup(sc);
+			cv_signal(&sc->cv);
 			mtx_unlock(&sc->mtx);
 		}
 		if (sockevent & CBB_SOCKET_EVENT_CSTS) {

==== //depot/projects/kse/sys/dev/pccbb/pccbbvar.h#6 (text+ko) ====

@@ -25,7 +25,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/pccbb/pccbbvar.h,v 1.10 2002/02/17 03:11:11 imp Exp $
+ * $FreeBSD: src/sys/dev/pccbb/pccbbvar.h,v 1.11 2002/06/13 07:19:31 imp Exp $
  */
 
 /*
@@ -62,7 +62,8 @@
 	bus_space_handle_t bsh;
 	u_int8_t	secbus;
 	u_int8_t	subbus;
-	struct		mtx mtx;
+	struct mtx	mtx;
+	struct cv	cv;
 	u_int32_t	flags;
 #define	PCCBB_16BIT_CARD	0x02000000
 #define	PCCBB_KTHREAD_RUNNING	0x04000000

==== //depot/projects/kse/sys/fs/nullfs/null.h#3 (text+ko) ====

@@ -35,7 +35,7 @@
  *
  *	@(#)null.h	8.3 (Berkeley) 8/20/94
  *
- * $FreeBSD: src/sys/fs/nullfs/null.h,v 1.16 2002/05/23 23:07:27 mux Exp $
+ * $FreeBSD: src/sys/fs/nullfs/null.h,v 1.18 2002/06/13 21:49:09 semenu Exp $
  */
 
 struct null_mount {
@@ -59,7 +59,8 @@
 
 int nullfs_init(struct vfsconf *vfsp);
 int nullfs_uninit(struct vfsconf *vfsp);
-int null_node_create(struct mount *mp, struct vnode *target, struct vnode **vpp);
+int null_nodeget(struct mount *mp, struct vnode *target, struct vnode **vpp);
+void null_hashrem(struct null_node *xp);
 int null_bypass(struct vop_generic_args *ap);
 
 #ifdef DIAGNOSTIC
@@ -70,7 +71,6 @@
 #endif
 
 extern vop_t **null_vnodeop_p;
-extern struct lock null_hashlock;
 
 #ifdef MALLOC_DECLARE
 MALLOC_DECLARE(M_NULLFSNODE);

==== //depot/projects/kse/sys/fs/nullfs/null_subr.c#4 (text+ko) ====

@@ -35,13 +35,14 @@
  *
  *	@(#)null_subr.c	8.7 (Berkeley) 5/14/95
  *
- * $FreeBSD: src/sys/fs/nullfs/null_subr.c,v 1.32 2001/09/12 08:37:19 julian Exp $
+ * $FreeBSD: src/sys/fs/nullfs/null_subr.c,v 1.35 2002/06/13 21:49:09 semenu Exp $
  */
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/lock.h>
+#include <sys/mutex.h>
 #include <sys/malloc.h>
 #include <sys/mount.h>
 #include <sys/proc.h>
@@ -65,15 +66,13 @@
 
 static LIST_HEAD(null_node_hashhead, null_node) *null_node_hashtbl;
 static u_long null_node_hash;
-struct lock null_hashlock;
+struct mtx null_hashmtx;
 
 static MALLOC_DEFINE(M_NULLFSHASH, "NULLFS hash", "NULLFS hash table");
 MALLOC_DEFINE(M_NULLFSNODE, "NULLFS node", "NULLFS vnode private part");
 
-static int	null_node_alloc(struct mount *mp, struct vnode *lowervp,
-				     struct vnode **vpp);
-static struct vnode *
-		null_node_find(struct mount *mp, struct vnode *lowervp);
+static struct vnode * null_hashget(struct vnode *);
+static struct vnode * null_hashins(struct null_node *);
 
 /*
  * Initialise cache headers
@@ -85,7 +84,7 @@
 
 	NULLFSDEBUG("nullfs_init\n");		/* printed during system boot */
 	null_node_hashtbl = hashinit(NNULLNODECACHE, M_NULLFSHASH, &null_node_hash);
-	lockinit(&null_hashlock, PVFS, "nullhs", 0, 0);
+	mtx_init(&null_hashmtx, "nullhs", NULL, MTX_DEF);
 	return (0);
 }
 
@@ -94,10 +93,8 @@
 	struct vfsconf *vfsp;
 {
 
-        if (null_node_hashtbl) {
-		lockdestroy(&null_hashlock);
-		free(null_node_hashtbl, M_NULLFSHASH);
-	}
+	mtx_destroy(&null_hashmtx);
+	free(null_node_hashtbl, M_NULLFSHASH);
 	return (0);
 }
 
@@ -106,8 +103,7 @@
  * Lower vnode should be locked on entry and will be left locked on exit.
  */
 static struct vnode *
-null_node_find(mp, lowervp)
-	struct mount *mp;
+null_hashget(lowervp)
 	struct vnode *lowervp;
 {
 	struct thread *td = curthread;	/* XXX */
@@ -123,51 +119,93 @@
 	 */
 	hd = NULL_NHASH(lowervp);
 loop:
-	lockmgr(&null_hashlock, LK_EXCLUSIVE, NULL, td);
+	mtx_lock(&null_hashmtx);
 	LIST_FOREACH(a, hd, null_hash) {
-		if (a->null_lowervp == lowervp && NULLTOV(a)->v_mount == mp) {
+		if (a->null_lowervp == lowervp) {
 			vp = NULLTOV(a);
-			lockmgr(&null_hashlock, LK_RELEASE, NULL, td);
+			mtx_lock(&vp->v_interlock);
+			mtx_unlock(&null_hashmtx);
 			/*
 			 * We need vget for the VXLOCK
 			 * stuff, but we don't want to lock
 			 * the lower node.
 			 */
-			if (vget(vp, LK_EXCLUSIVE | LK_CANRECURSE, td)) {
-				printf ("null_node_find: vget failed.\n");
+			if (vget(vp, LK_EXCLUSIVE | LK_THISLAYER | LK_INTERLOCK, td))
 				goto loop;
-			};
-			/*
-			 * Now we got both vnodes locked, so release the
-			 * lower one.
-			 */
-			VOP_UNLOCK(lowervp, 0, td);
+
 			return (vp);
 		}
 	}
-	lockmgr(&null_hashlock, LK_RELEASE, NULL, td);
+	mtx_unlock(&null_hashmtx);
+	return (NULLVP);
+}
+
+/*
+ * Act like null_hashget, but add passed null_node to hash if no existing
+ * node found.
+ */
+static struct vnode *
+null_hashins(xp)
+	struct null_node *xp;
+{
+	struct thread *td = curthread;	/* XXX */
+	struct null_node_hashhead *hd;
+	struct null_node *oxp;
+	struct vnode *ovp;
+
+	hd = NULL_NHASH(xp->null_lowervp);
+loop:
+	mtx_lock(&null_hashmtx);
+	LIST_FOREACH(oxp, hd, null_hash) {
+		if (oxp->null_lowervp == xp->null_lowervp) {
+			ovp = NULLTOV(oxp);
+			mtx_lock(&ovp->v_interlock);
+			mtx_unlock(&null_hashmtx);
+			if (vget(ovp, LK_EXCLUSIVE | LK_THISLAYER | LK_INTERLOCK, td))
+				goto loop;
 
-	return NULLVP;
+			return (ovp);
+		}
+	}
+	LIST_INSERT_HEAD(hd, xp, null_hash);
+	mtx_unlock(&null_hashmtx);
+	return (NULLVP);
 }
 
-
 /*
- * Make a new null_node node.
- * Vp is the alias vnode, lofsvp is the lower vnode.
- * Maintain a reference to (lowervp).
+ * Make a new or get existing nullfs node.
+ * Vp is the alias vnode, lowervp is the lower vnode.
+ * 
+ * The lowervp assumed to be locked and having "spare" reference. This routine
+ * vrele lowervp if nullfs node was taken from hash. Otherwise it "transfers"
+ * the caller's "spare" reference to created nullfs vnode.
  */
-static int
-null_node_alloc(mp, lowervp, vpp)
+int
+null_nodeget(mp, lowervp, vpp)
 	struct mount *mp;
 	struct vnode *lowervp;
 	struct vnode **vpp;
 {
 	struct thread *td = curthread;	/* XXX */
-	struct null_node_hashhead *hd;
 	struct null_node *xp;
-	struct vnode *othervp, *vp;
+	struct vnode *vp;
 	int error;
 
+	/* Lookup the hash firstly */
+	*vpp = null_hashget(lowervp);
+	if (*vpp != NULL) {
+		vrele(lowervp);
+		return (0);
+	}
+
+	/*
+	 * We do not serialize vnode creation, instead we will check for
+	 * duplicates later, when adding new vnode to hash.
+	 *
+	 * Note that duplicate can only appear in hash if the lowervp is
+	 * locked LK_SHARED.
+	 */
+
 	/*
 	 * Do the MALLOC before the getnewvnode since doing so afterward
 	 * might cause a bogus v_data pointer to get dereferenced
@@ -176,31 +214,20 @@
 	MALLOC(xp, struct null_node *, sizeof(struct null_node),
 	    M_NULLFSNODE, M_WAITOK);
 
-	error = getnewvnode(VT_NULL, mp, null_vnodeop_p, vpp);
+	error = getnewvnode(VT_NULL, mp, null_vnodeop_p, &vp);
 	if (error) {
 		FREE(xp, M_NULLFSNODE);
 		return (error);
 	}
-	vp = *vpp;
+
+	xp->null_vnode = vp;
+	xp->null_lowervp = lowervp;
 
 	vp->v_type = lowervp->v_type;
-	xp->null_vnode = vp;
 	vp->v_data = xp;
-	xp->null_lowervp = lowervp;
-	/*
-	 * Before we insert our new node onto the hash chains,
-	 * check to see if someone else has beaten us to it.
-	 * (We could have slept in MALLOC.)
-	 */
-	othervp = null_node_find(mp, lowervp);
-	if (othervp) {
-		vp->v_data = NULL;
-		FREE(xp, M_NULLFSNODE);
-		vp->v_type = VBAD;	/* node is discarded */
-		vrele(vp);
-		*vpp = othervp;
-		return 0;
-	};
+
+	/* Though v_lock is inited by getnewvnode(), we want our own wmesg */
+	lockinit(&vp->v_lock, PVFS, "nunode", VLKTIMEOUT, LK_NOPAUSE);
 
 	/*
 	 * From NetBSD:
@@ -211,79 +238,49 @@
 	 * NULL, then we copy that up and manually lock the new vnode.
 	 */
 
-	lockmgr(&null_hashlock, LK_EXCLUSIVE, NULL, td);
 	vp->v_vnlock = lowervp->v_vnlock;
 	error = VOP_LOCK(vp, LK_EXCLUSIVE | LK_THISLAYER, td);
 	if (error)
-		panic("null_node_alloc: can't lock new vnode\n");
+		panic("null_nodeget: can't lock new vnode\n");
+
+	/*
+	 * Atomically insert our new node into the hash or vget existing 
+	 * if someone else has beaten us to it.
+	 */
+	*vpp = null_hashins(xp);
+	if (*vpp != NULL) {
+		vrele(lowervp);
+		VOP_UNLOCK(vp, LK_THISLAYER, td);
+		vp->v_vnlock = NULL;
+		xp->null_lowervp = NULL;
+		vrele(vp);
+		return (0);
+	}
 
+	/*
+	 * XXX We take extra vref just to workaround UFS's XXX:
+	 * UFS can vrele() vnode in VOP_CLOSE() in some cases. Luckily, this
+	 * can only happen if v_usecount == 1. To workaround, we just don't
+	 * let v_usecount be 1, it will be 2 or more.
+	 */
 	VREF(lowervp);
-	hd = NULL_NHASH(lowervp);
-	LIST_INSERT_HEAD(hd, xp, null_hash);
-	lockmgr(&null_hashlock, LK_RELEASE, NULL, td);
-	return 0;
+
+	*vpp = vp;
+
+	return (0);
 }
 
-
 /*
- * Try to find an existing null_node vnode refering to the given underlying
- * vnode (which should be locked). If no vnode found, create a new null_node
- * vnode which contains a reference to the lower vnode.
+ * Remove node from hash.
  */
-int
-null_node_create(mp, lowervp, newvpp)
-	struct mount *mp;
-	struct vnode *lowervp;
-	struct vnode **newvpp;
+void
+null_hashrem(xp)
+	struct null_node *xp;
 {
-	struct vnode *aliasvp;
 
-	aliasvp = null_node_find(mp, lowervp);
-	if (aliasvp) {
-		/*
-		 * null_node_find has taken another reference
-		 * to the alias vnode.
-		 */
-		 vrele(lowervp);
-#ifdef NULLFS_DEBUG
-		vprint("null_node_create: exists", aliasvp);
-#endif
-	} else {
-		int error;
-
-		/*
-		 * Get new vnode.
-		 */
-		NULLFSDEBUG("null_node_create: create new alias vnode\n");
-
-		/*
-		 * Make new vnode reference the null_node.
-		 */
-		error = null_node_alloc(mp, lowervp, &aliasvp);
-		if (error)
-			return error;
-
-		/*
-		 * aliasvp is already VREF'd by getnewvnode()
-		 */
-	}
-
-#ifdef DIAGNOSTIC
-	if (lowervp->v_usecount < 1) {
-		/* Should never happen... */
-		vprint ("null_node_create: alias ", aliasvp);
-		vprint ("null_node_create: lower ", lowervp);
-		panic ("null_node_create: lower has 0 usecount.");
-	};
-#endif
-
-#ifdef NULLFS_DEBUG
-	vprint("null_node_create: alias", aliasvp);
-	vprint("null_node_create: lower", lowervp);
-#endif
-
-	*newvpp = aliasvp;
-	return (0);
+	mtx_lock(&null_hashmtx);
+	LIST_REMOVE(xp, null_hash);
+	mtx_unlock(&null_hashmtx);
 }
 
 #ifdef DIAGNOSTIC

==== //depot/projects/kse/sys/fs/nullfs/null_vfsops.c#6 (text+ko) ====

@@ -36,7 +36,7 @@
  *	@(#)null_vfsops.c	8.2 (Berkeley) 1/21/94
  *
  * @(#)lofs_vfsops.c	1.2 (Berkeley) 6/18/92
- * $FreeBSD: src/sys/fs/nullfs/null_vfsops.c,v 1.52 2002/05/23 23:07:27 mux Exp $
+ * $FreeBSD: src/sys/fs/nullfs/null_vfsops.c,v 1.53 2002/06/13 21:49:09 semenu Exp $
  */
 
 /*
@@ -169,7 +169,7 @@
 	 * Save reference.  Each mount also holds
 	 * a reference on the root vnode.
 	 */
-	error = null_node_create(mp, lowerrootvp, &vp);
+	error = null_nodeget(mp, lowerrootvp, &vp);
 	/*
 	 * Unlock the node (either the lower or the alias)
 	 */
@@ -354,7 +354,7 @@
 	if (error)
 		return (error);
 
-	return (null_node_create(mp, *vpp, vpp));
+	return (null_nodeget(mp, *vpp, vpp));
 }
 
 static int
@@ -368,7 +368,7 @@
 	if (error)
 		return (error);
 
-	return (null_node_create(mp, *vpp, vpp));
+	return (null_nodeget(mp, *vpp, vpp));
 }
 
 static int

==== //depot/projects/kse/sys/fs/nullfs/null_vnops.c#8 (text+ko) ====

@@ -40,7 +40,7 @@
  *	...and...
  *	@(#)null_vnodeops.c 1.20 92/07/07 UCLA Ficus project
  *
- * $FreeBSD: src/sys/fs/nullfs/null_vnops.c,v 1.53 2002/05/21 18:07:33 semenu Exp $
+ * $FreeBSD: src/sys/fs/nullfs/null_vnops.c,v 1.56 2002/06/13 21:49:09 semenu Exp $
  */
 
 /*
@@ -346,7 +346,7 @@
 		vppp = VOPARG_OFFSETTO(struct vnode***,
 				 descp->vdesc_vpp_offset,ap);
 		if (*vppp)
-			error = null_node_create(old_vps[0]->v_mount, **vppp, *vppp);
+			error = null_nodeget(old_vps[0]->v_mount, **vppp, *vppp);
 	}
 
  out:
@@ -400,9 +400,12 @@
 			VREF(dvp);
 			vrele(lvp);
 		} else {
-			error = null_node_create(dvp->v_mount, lvp, &vp);
-			if (error == 0)
-				*ap->a_vpp = vp;
+			error = null_nodeget(dvp->v_mount, lvp, &vp);
+			if (error) {
+				/* XXX Cleanup needed... */
+				panic("null_nodeget failed");
+			}
+			*ap->a_vpp = vp;
 		}
 	}
 	return (error);
@@ -706,6 +709,11 @@
  * There is no way to tell that someone issued remove/rmdir operation
  * on the underlying filesystem. For now we just have to release lowevrp
  * as soon as possible.
+ *
+ * Note, we can't release any resources nor remove vnode from hash before 
+ * appropriate VXLOCK stuff is is done because other process can find this
+ * vnode in hash during inactivation and may be sitting in vget() and waiting
+ * for null_inactive to unlock vnode. Thus we will do all those in VOP_RECLAIM.
  */
 static int
 null_inactive(ap)
@@ -715,19 +723,21 @@
 	} */ *ap;
 {
 	struct vnode *vp = ap->a_vp;
+	struct thread *td = ap->a_td;
+
+	VOP_UNLOCK(vp, 0, td);
 
 	/*
 	 * If this is the last reference, then free up the vnode
 	 * so as not to tie up the lower vnodes.
 	 */
-	if (vp->v_usecount == 0)
-		vrecycle(vp, NULL, ap->a_td);
+	vrecycle(vp, NULL, td);
+
 	return (0);
 }
 
 /*
- * We can free memory in null_inactive, but we do this
- * here. (Possible to guard vp->v_data to point somewhere)
+ * Now, the VXLOCK is in force and we're free to destroy the null vnode.
  */
 static int
 null_reclaim(ap)
@@ -736,32 +746,19 @@
 		struct thread *a_td;
 	} */ *ap;
 {
-	struct thread *td = ap->a_td;
 	struct vnode *vp = ap->a_vp;
 	struct null_node *xp = VTONULL(vp);
 	struct vnode *lowervp = xp->null_lowervp;
-	void *vdata;
 
-	lockmgr(&null_hashlock, LK_EXCLUSIVE, NULL, td);
-	LIST_REMOVE(xp, null_hash);
-	lockmgr(&null_hashlock, LK_RELEASE, NULL, td);
+	if (lowervp) {
+		null_hashrem(xp);
 
-	xp->null_lowervp = NULLVP;
-	if (vp->v_vnlock != NULL) {
-		vp->v_vnlock = &vp->v_lock;  /* we no longer share the lock */
-	} else
-		VOP_UNLOCK(vp, LK_THISLAYER, td);
+		vrele(lowervp);
+		vrele(lowervp);
+	}
 
-	/*
-	 * Now it is safe to drop references to the lower vnode.
-	 * VOP_INACTIVE() will be called by vrele() if necessary.
-	 */
-	vput(lowervp);
-	vrele (lowervp);
-
-	vdata = vp->v_data;
 	vp->v_data = NULL;
-	FREE(vdata, M_NULLFSNODE);
+	FREE(xp, M_NULLFSNODE);
 
 	return (0);
 }

==== //depot/projects/kse/sys/i4b/capi/iavc/iavc_card.c#2 (text+ko) ====

@@ -25,12 +25,11 @@
  * capi/iavc/iavc_card.c
  *		The AVM ISDN controllers' card specific support routines.
  *
- * $FreeBSD: src/sys/i4b/capi/iavc/iavc_card.c,v 1.1 2001/05/25 08:39:32 hm Exp $
+ * $FreeBSD: src/sys/i4b/capi/iavc/iavc_card.c,v 1.2 2002/06/13 06:04:25 brooks Exp $
  */
 
 #include "iavc.h"
 #include "i4bcapi.h"
-#include "pci.h"
 
 #if (NIAVC > 0) && (NI4BCAPI > 0)
 

==== //depot/projects/kse/sys/i4b/capi/iavc/iavc_lli.c#3 (text+ko) ====

@@ -25,12 +25,11 @@
  * capi/iavc/iavc_lli.c
  *		The AVM ISDN controllers' Low Level Interface.
  *
- * $FreeBSD: src/sys/i4b/capi/iavc/iavc_lli.c,v 1.3 2002/03/17 09:33:13 hm Exp $
+ * $FreeBSD: src/sys/i4b/capi/iavc/iavc_lli.c,v 1.4 2002/06/13 06:04:25 brooks Exp $
  */
 
 #include "iavc.h"
 #include "i4bcapi.h"
-#include "pci.h"
 
 #if (NIAVC > 0) && (NI4BCAPI > 0)
 

==== //depot/projects/kse/sys/i4b/capi/iavc/iavc_pci.c#5 (text+ko) ====

@@ -25,14 +25,13 @@
  * capi/iavc/iavc_pci.c
  *		The AVM ISDN controllers' PCI bus attachment handling.
  *
- * $FreeBSD: src/sys/i4b/capi/iavc/iavc_pci.c,v 1.4 2002/04/04 21:03:20 jhb Exp $
+ * $FreeBSD: src/sys/i4b/capi/iavc/iavc_pci.c,v 1.5 2002/06/13 06:04:25 brooks Exp $
  */
 
 #include "iavc.h"
 #include "i4bcapi.h"
-#include "pci.h"
 
-#if (NIAVC > 0) && (NI4BCAPI > 0) && (NPCI > 0)
+#if (NIAVC > 0) && (NI4BCAPI > 0)
 
 #include <sys/param.h>
 #include <sys/kernel.h>

==== //depot/projects/kse/sys/i4b/layer1/ifpi/i4b_ifpi_isac.c#2 (text+ko) ====

@@ -29,16 +29,15 @@
  *
  *	$Id: i4b_ifpi_isac.c,v 1.3 2000/05/29 15:41:41 hm Exp $ 
  *
- * $FreeBSD: src/sys/i4b/layer1/ifpi/i4b_ifpi_isac.c,v 1.4 2000/10/30 14:49:22 hm Exp $
+ * $FreeBSD: src/sys/i4b/layer1/ifpi/i4b_ifpi_isac.c,v 1.5 2002/06/13 06:04:26 brooks Exp $
  *
  *      last edit-date: [Mon May 29 15:22:52 2000]
  *
  *---------------------------------------------------------------------------*/
 
 #include "ifpi.h"
-#include "pci.h"
 
-#if (NIFPI > 0) && (NPCI > 0)
+#if (NIFPI > 0)
 
 #include "opt_i4b.h"
 

==== //depot/projects/kse/sys/i4b/layer1/ifpi/i4b_ifpi_l1.c#2 (text+ko) ====

@@ -29,16 +29,15 @@
  *
  *	$Id: i4b_ifpi_l1.c,v 1.4 2000/06/02 16:14:36 hm Exp $ 
  *
- * $FreeBSD: src/sys/i4b/layer1/ifpi/i4b_ifpi_l1.c,v 1.4 2000/10/30 14:49:22 hm Exp $
+ * $FreeBSD: src/sys/i4b/layer1/ifpi/i4b_ifpi_l1.c,v 1.5 2002/06/13 06:04:26 brooks Exp $
  *
  *      last edit-date: [Fri Jun  2 14:54:30 2000]
  *
  *---------------------------------------------------------------------------*/
 
 #include "ifpi.h"
-#include "pci.h"
 
-#if (NIFPI > 0) && (NPCI > 0)
+#if (NIFPI > 0)
 
 #include <sys/param.h>
 #include <sys/systm.h>

==== //depot/projects/kse/sys/i4b/layer1/ifpi/i4b_ifpi_l1fsm.c#2 (text+ko) ====

@@ -29,16 +29,15 @@
  *
  *	$Id: i4b_ifpi_l1fsm.c,v 1.4 2000/05/29 15:41:41 hm Exp $ 
  *
- * $FreeBSD: src/sys/i4b/layer1/ifpi/i4b_ifpi_l1fsm.c,v 1.4 2000/10/30 14:49:22 hm Exp $
+ * $FreeBSD: src/sys/i4b/layer1/ifpi/i4b_ifpi_l1fsm.c,v 1.5 2002/06/13 06:04:26 brooks Exp $
  *
  *      last edit-date: [Mon May 29 15:23:15 2000]
  *

>>> TRUNCATED FOR MAIL (1000 lines) <<<

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206140614.g5E6E9S88373>