Module Name:    src
Committed By:   hannken
Date:           Sat Dec 13 15:57:46 UTC 2014

Modified Files:
        src/sys/coda: coda_subr.c coda_vfsops.c coda_vnops.c

Log Message:
Attach the control object vnode to the coda mount and release it
on unmount.  Initialize special files with NODEV.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/coda/coda_subr.c
cvs rdiff -u -r1.81 -r1.82 src/sys/coda/coda_vfsops.c
cvs rdiff -u -r1.98 -r1.99 src/sys/coda/coda_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/coda/coda_subr.c
diff -u src/sys/coda/coda_subr.c:1.27 src/sys/coda/coda_subr.c:1.28
--- src/sys/coda/coda_subr.c:1.27	Thu Aug  2 16:06:58 2012
+++ src/sys/coda/coda_subr.c	Sat Dec 13 15:57:46 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_subr.c,v 1.27 2012/08/02 16:06:58 christos Exp $	*/
+/*	$NetBSD: coda_subr.c,v 1.28 2014/12/13 15:57:46 hannken Exp $	*/
 
 /*
  *
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coda_subr.c,v 1.27 2012/08/02 16:06:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_subr.c,v 1.28 2014/12/13 15:57:46 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -228,6 +228,8 @@ coda_kill(struct mount *whoIam, enum dc_
 
 	for (hash = 0; hash < CODA_CACHESIZE; hash++) {
 		for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) {
+			if (IS_CTL_VP(CTOV(cp)))
+				continue;
 			if (CTOV(cp)->v_mount == whoIam) {
 #ifdef	DEBUG
 				printf("coda_kill: vp %p, cp %p\n", CTOV(cp), cp);
@@ -302,11 +304,6 @@ coda_unmounting(struct mount *whoIam)
 	for (hash = 0; hash < CODA_CACHESIZE; hash++) {
 		for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) {
 			if (CTOV(cp)->v_mount == whoIam) {
-				if (cp->c_flags & (C_LOCKED|C_WANTED)) {
-					printf("coda_unmounting: Unlocking %p\n", cp);
-					cp->c_flags &= ~(C_LOCKED|C_WANTED);
-					wakeup((void *) cp);
-				}
 				cp->c_flags |= C_UNMOUNTING;
 			}
 		}

Index: src/sys/coda/coda_vfsops.c
diff -u src/sys/coda/coda_vfsops.c:1.81 src/sys/coda/coda_vfsops.c:1.82
--- src/sys/coda/coda_vfsops.c:1.81	Wed Apr 16 18:55:17 2014
+++ src/sys/coda/coda_vfsops.c	Sat Dec 13 15:57:46 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vfsops.c,v 1.81 2014/04/16 18:55:17 maxv Exp $	*/
+/*	$NetBSD: coda_vfsops.c,v 1.82 2014/12/13 15:57:46 hannken Exp $	*/
 
 /*
  *
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.81 2014/04/16 18:55:17 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.82 2014/12/13 15:57:46 hannken Exp $");
 
 #ifndef _KERNEL_OPT
 #define	NVCODA 4
@@ -264,12 +264,7 @@ coda_mount(struct mount *vfsp,	/* Alloca
     rtvp = CTOV(cp);
     rtvp->v_vflag |= VV_ROOT;
 
-/*  cp = make_coda_node(&ctlfid, vfsp, VCHR);
-    The above code seems to cause a loop in the cnode links.
-    I don't totally understand when it happens, it is caught
-    when closing down the system.
- */
-    cp = make_coda_node(&ctlfid, 0, VCHR);
+    cp = make_coda_node(&ctlfid, vfsp, VCHR);
 
     coda_ctlvp = CTOV(cp);
 
@@ -325,6 +320,7 @@ coda_unmount(struct mount *vfsp, int mnt
 	mi->mi_started = 0;
 
 	vrele(mi->mi_rootvp);
+	vrele(coda_ctlvp);
 
 	active = coda_kill(vfsp, NOT_DOWNCALL);
 	mi->mi_rootvp->v_vflag &= ~VV_ROOT;

Index: src/sys/coda/coda_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.98 src/sys/coda/coda_vnops.c:1.99
--- src/sys/coda/coda_vnops.c:1.98	Sat Oct 18 08:33:27 2014
+++ src/sys/coda/coda_vnops.c	Sat Dec 13 15:57:46 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.98 2014/10/18 08:33:27 snj Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.99 2014/12/13 15:57:46 hannken Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.98 2014/10/18 08:33:27 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.99 2014/12/13 15:57:46 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -64,6 +64,7 @@ __KERNEL_RCSID(0, "$NetBSD: coda_vnops.c
 #include <sys/kauth.h>
 
 #include <miscfs/genfs/genfs.h>
+#include <miscfs/specfs/specdev.h>
 
 #include <coda/coda.h>
 #include <coda/cnode.h>
@@ -836,6 +837,7 @@ coda_inactive(void *v)
 
     if (IS_CTL_VP(vp)) {
 	MARK_INT_SAT(CODA_INACTIVE_STATS);
+	VOP_UNLOCK(vp);
 	return 0;
     }
 
@@ -1844,6 +1846,8 @@ make_coda_node(CodaFid *fid, struct moun
 	vp->v_data = cp;
 	vp->v_type = type;
 	cp->c_vnode = vp;
+	if (type == VCHR || type == VBLK)
+		spec_node_init(vp, NODEV);
 	uvm_vnp_setsize(vp, 0);
 	coda_save(cp);
 
@@ -2014,7 +2018,7 @@ coda_putpages(void *v)
 #ifdef CODA_VERBOSE
 		printf("%s: control object %p\n", __func__, vp);
 #endif
-		return(EINVAL);
+		return 0;
 	}
 
 	/*

Reply via email to