CVS commit: src/sys/coda

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri May 17 23:57:46 UTC 2024

Modified Files:
src/sys/coda: coda_namecache.c coda_psdev.c coda_subr.c coda_venus.c
coda_vfsops.c

Log Message:
Remove unnecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/coda/coda_namecache.c
cvs rdiff -u -r1.64 -r1.65 src/sys/coda/coda_psdev.c
cvs rdiff -u -r1.32 -r1.33 src/sys/coda/coda_subr.c
cvs rdiff -u -r1.30 -r1.31 src/sys/coda/coda_venus.c
cvs rdiff -u -r1.90 -r1.91 src/sys/coda/coda_vfsops.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_namecache.c
diff -u src/sys/coda/coda_namecache.c:1.29 src/sys/coda/coda_namecache.c:1.30
--- src/sys/coda/coda_namecache.c:1.29	Fri Feb  9 22:08:34 2024
+++ src/sys/coda/coda_namecache.c	Fri May 17 23:57:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_namecache.c,v 1.29 2024/02/09 22:08:34 andvar Exp $	*/
+/*	$NetBSD: coda_namecache.c,v 1.30 2024/05/17 23:57:46 thorpej Exp $	*/
 
 /*
  *
@@ -77,11 +77,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_namecache.c,v 1.29 2024/02/09 22:08:34 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_namecache.c,v 1.30 2024/05/17 23:57:46 thorpej Exp $");
 
 #include 
 #include 
-#include 
 #include 
 #include 
 

Index: src/sys/coda/coda_psdev.c
diff -u src/sys/coda/coda_psdev.c:1.64 src/sys/coda/coda_psdev.c:1.65
--- src/sys/coda/coda_psdev.c:1.64	Tue Feb 13 21:39:02 2024
+++ src/sys/coda/coda_psdev.c	Fri May 17 23:57:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_psdev.c,v 1.64 2024/02/13 21:39:02 andvar Exp $	*/
+/*	$NetBSD: coda_psdev.c,v 1.65 2024/05/17 23:57:46 thorpej Exp $	*/
 
 /*
  *
@@ -54,14 +54,13 @@
 /* These routines are the device entry points for Venus. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_psdev.c,v 1.64 2024/02/13 21:39:02 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_psdev.c,v 1.65 2024/05/17 23:57:46 thorpej Exp $");
 
 extern int coda_nc_initialized;/* Set if cache has been initialized */
 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Index: src/sys/coda/coda_subr.c
diff -u src/sys/coda/coda_subr.c:1.32 src/sys/coda/coda_subr.c:1.33
--- src/sys/coda/coda_subr.c:1.32	Mon Apr 13 19:23:17 2020
+++ src/sys/coda/coda_subr.c	Fri May 17 23:57:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_subr.c,v 1.32 2020/04/13 19:23:17 ad Exp $	*/
+/*	$NetBSD: coda_subr.c,v 1.33 2024/05/17 23:57:46 thorpej Exp $	*/
 
 /*
  *
@@ -55,11 +55,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_subr.c,v 1.32 2020/04/13 19:23:17 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_subr.c,v 1.33 2024/05/17 23:57:46 thorpej Exp $");
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Index: src/sys/coda/coda_venus.c
diff -u src/sys/coda/coda_venus.c:1.30 src/sys/coda/coda_venus.c:1.31
--- src/sys/coda/coda_venus.c:1.30	Thu Oct 17 20:56:02 2013
+++ src/sys/coda/coda_venus.c	Fri May 17 23:57:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_venus.c,v 1.30 2013/10/17 20:56:02 christos Exp $	*/
+/*	$NetBSD: coda_venus.c,v 1.31 2024/05/17 23:57:46 thorpej Exp $	*/
 
 /*
  *
@@ -32,11 +32,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_venus.c,v 1.30 2013/10/17 20:56:02 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_venus.c,v 1.31 2024/05/17 23:57:46 thorpej Exp $");
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Index: src/sys/coda/coda_vfsops.c
diff -u src/sys/coda/coda_vfsops.c:1.90 src/sys/coda/coda_vfsops.c:1.91
--- src/sys/coda/coda_vfsops.c:1.90	Mon Mar 28 12:37:46 2022
+++ src/sys/coda/coda_vfsops.c	Fri May 17 23:57:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vfsops.c,v 1.90 2022/03/28 12:37:46 riastradh Exp $	*/
+/*	$NetBSD: coda_vfsops.c,v 1.91 2024/05/17 23:57:46 thorpej Exp $	*/
 
 /*
  *
@@ -45,12 +45,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.90 2022/03/28 12:37:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.91 2024/05/17 23:57:46 thorpej Exp $");
 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 



CVS commit: src/sys/coda

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri May 17 23:57:46 UTC 2024

Modified Files:
src/sys/coda: coda_namecache.c coda_psdev.c coda_subr.c coda_venus.c
coda_vfsops.c

Log Message:
Remove unnecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/coda/coda_namecache.c
cvs rdiff -u -r1.64 -r1.65 src/sys/coda/coda_psdev.c
cvs rdiff -u -r1.32 -r1.33 src/sys/coda/coda_subr.c
cvs rdiff -u -r1.30 -r1.31 src/sys/coda/coda_venus.c
cvs rdiff -u -r1.90 -r1.91 src/sys/coda/coda_vfsops.c

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



CVS commit: src/sys/coda

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri May 17 23:56:24 UTC 2024

Modified Files:
src/sys/coda: cnode.h

Log Message:
 -> 


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/coda/cnode.h

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/cnode.h
diff -u src/sys/coda/cnode.h:1.20 src/sys/coda/cnode.h:1.21
--- src/sys/coda/cnode.h:1.20	Sat Dec 13 15:59:30 2014
+++ src/sys/coda/cnode.h	Fri May 17 23:56:24 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cnode.h,v 1.20 2014/12/13 15:59:30 hannken Exp $	*/
+/*	$NetBSD: cnode.h,v 1.21 2024/05/17 23:56:24 thorpej Exp $	*/
 
 /*
  *
@@ -49,7 +49,7 @@
 
 #include 
 #ifdef _KERNEL
-#include 
+#include 
 
 MALLOC_DECLARE(M_CODA);
 #endif



CVS commit: src/sys/coda

2024-05-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri May 17 23:56:24 UTC 2024

Modified Files:
src/sys/coda: cnode.h

Log Message:
 -> 


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/coda/cnode.h

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



CVS commit: src/sys/coda

2023-08-02 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Aug  3 03:10:23 UTC 2023

Modified Files:
src/sys/coda: coda_psdev.c

Log Message:
coda_call(): Appease GCC 12.3.0 -Wmisleading-indentation
No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/coda/coda_psdev.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_psdev.c
diff -u src/sys/coda/coda_psdev.c:1.62 src/sys/coda/coda_psdev.c:1.63
--- src/sys/coda/coda_psdev.c:1.62	Tue May  3 20:52:31 2022
+++ src/sys/coda/coda_psdev.c	Thu Aug  3 03:10:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_psdev.c,v 1.62 2022/05/03 20:52:31 andvar Exp $	*/
+/*	$NetBSD: coda_psdev.c,v 1.63 2023/08/03 03:10:23 rin Exp $	*/
 
 /*
  *
@@ -54,7 +54,7 @@
 /* These routines are the device entry points for Venus. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_psdev.c,v 1.62 2022/05/03 20:52:31 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_psdev.c,v 1.63 2023/08/03 03:10:23 rin Exp $");
 
 extern int coda_nc_initialized;/* Set if cache has been initialized */
 
@@ -712,9 +712,10 @@ coda_call(struct coda_mntinfo *mntinfo, 
 	}
 
 	else {	/* If venus died (!VC_OPEN(vcp)) */
-	if (codadebug)
-		myprintf(("vcclose woke op %d.%d flags %d\n",
-		   vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags));
+		if (codadebug) {
+			myprintf(("vcclose woke op %d.%d flags %d\n",
+			   vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags));
+		}
 
 		error = ENODEV;
 	}



CVS commit: src/sys/coda

2023-08-02 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Aug  3 03:10:23 UTC 2023

Modified Files:
src/sys/coda: coda_psdev.c

Log Message:
coda_call(): Appease GCC 12.3.0 -Wmisleading-indentation
No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/coda/coda_psdev.c

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



CVS commit: src/sys/coda

2021-12-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  5 08:10:39 UTC 2021

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

Log Message:
s/sybolic/symbolic/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 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_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.116 src/sys/coda/coda_vnops.c:1.117
--- src/sys/coda/coda_vnops.c:1.116	Wed Oct 20 03:08:16 2021
+++ src/sys/coda/coda_vnops.c	Sun Dec  5 08:10:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.116 2021/10/20 03:08:16 thorpej Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.117 2021/12/05 08:10:39 msaitoh Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.116 2021/10/20 03:08:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.117 2021/12/05 08:10:39 msaitoh Exp $");
 
 #include 
 #include 
@@ -1465,7 +1465,7 @@ coda_symlink(void *v)
 /*
  * Here's the strategy for the moment: perform the symlink, then
  * do a lookup to grab the resulting vnode.  I know this requires
- * two communications with Venus for a new sybolic link, but
+ * two communications with Venus for a new symbolic link, but
  * that's the way the ball bounces.  I don't yet want to change
  * the way the Mach symlink works.  When Mach support is
  * deprecated, we should change symlink so that the common case



CVS commit: src/sys/coda

2021-12-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  5 08:10:39 UTC 2021

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

Log Message:
s/sybolic/symbolic/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 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.



CVS commit: src/sys/coda

2020-12-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 22:11:57 UTC 2020

Modified Files:
src/sys/coda: coda_psdev.c

Log Message:
Use sel{record,remove}_knote().


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/coda/coda_psdev.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_psdev.c
diff -u src/sys/coda/coda_psdev.c:1.58 src/sys/coda/coda_psdev.c:1.59
--- src/sys/coda/coda_psdev.c:1.58	Wed Oct 25 08:12:38 2017
+++ src/sys/coda/coda_psdev.c	Sat Dec 19 22:11:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_psdev.c,v 1.58 2017/10/25 08:12:38 maya Exp $	*/
+/*	$NetBSD: coda_psdev.c,v 1.59 2020/12/19 22:11:57 thorpej Exp $	*/
 
 /*
  *
@@ -54,7 +54,7 @@
 /* These routines are the device entry points for Venus. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_psdev.c,v 1.58 2017/10/25 08:12:38 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_psdev.c,v 1.59 2020/12/19 22:11:57 thorpej Exp $");
 
 extern int coda_nc_initialized;/* Set if cache has been initialized */
 
@@ -469,7 +469,7 @@ filt_vc_nb_detach(struct knote *kn)
 {
 	struct vcomm *vcp = kn->kn_hook;
 
-	SLIST_REMOVE(>vc_selproc.sel_klist, kn, knote, kn_selnext);
+	selremove_knote(>vc_selproc, kn);
 }
 
 static int
@@ -497,7 +497,6 @@ int
 vc_nb_kqfilter(dev_t dev, struct knote *kn)
 {
 	struct vcomm *vcp;
-	struct klist *klist;
 
 	ENTRY;
 
@@ -508,7 +507,6 @@ vc_nb_kqfilter(dev_t dev, struct knote *
 
 	switch (kn->kn_filter) {
 	case EVFILT_READ:
-		klist = >vc_selproc.sel_klist;
 		kn->kn_fop = _nb_read_filtops;
 		break;
 
@@ -518,7 +516,7 @@ vc_nb_kqfilter(dev_t dev, struct knote *
 
 	kn->kn_hook = vcp;
 
-	SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+	selrecord_knote(>vc_selproc, kn);
 
 	return (0);
 }



CVS commit: src/sys/coda

2020-12-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 22:11:57 UTC 2020

Modified Files:
src/sys/coda: coda_psdev.c

Log Message:
Use sel{record,remove}_knote().


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/coda/coda_psdev.c

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



CVS commit: src/sys/coda

2020-11-20 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Nov 20 10:08:47 UTC 2020

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

Log Message:
When validating the mount device string make sure its length
is below *data_len and below PATH_MAX.

Reported-by: syzbot+2d3af801141509cc8...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/coda/coda_vfsops.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_vfsops.c
diff -u src/sys/coda/coda_vfsops.c:1.88 src/sys/coda/coda_vfsops.c:1.89
--- src/sys/coda/coda_vfsops.c:1.88	Sat Nov 14 11:41:29 2020
+++ src/sys/coda/coda_vfsops.c	Fri Nov 20 10:08:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vfsops.c,v 1.88 2020/11/14 11:41:29 hannken Exp $	*/
+/*	$NetBSD: coda_vfsops.c,v 1.89 2020/11/20 10:08:47 hannken Exp $	*/
 
 /*
  *
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.88 2020/11/14 11:41:29 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.89 2020/11/20 10:08:47 hannken Exp $");
 
 #include 
 #include 
@@ -197,7 +197,11 @@ coda_mount(struct mount *vfsp,	/* Alloca
  * fixed default size for the filename buffer.
  */
 /* Ensure that namei() doesn't run off the filename buffer */
-((char *)data)[*data_len - 1] = 0;
+if (*data_len < 1 || *data_len > PATH_MAX ||
+	strnlen(data, *data_len) >= *data_len) {
+	MARK_INT_FAIL(CODA_MOUNT_STATS);
+	return EINVAL;
+}
 error = namei_simple_kernel((char *)data, NSM_FOLLOW_NOEMULROOT,
 		);
 



CVS commit: src/sys/coda

2020-11-20 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Nov 20 10:08:47 UTC 2020

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

Log Message:
When validating the mount device string make sure its length
is below *data_len and below PATH_MAX.

Reported-by: syzbot+2d3af801141509cc8...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/coda/coda_vfsops.c

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



CVS commit: src/sys/coda

2020-11-14 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Nov 14 11:42:56 UTC 2020

Modified Files:
src/sys/coda: coda.h coda_vnops.c

Log Message:
Rewrite coda_readdir() to directly process the container file.

Passing this operation down to the file system holding the container
cannot work for anything but UFS and UFS doesn't allow reading
directory from a plain file since ~2015.

Fixes PR kern/55775 Coda client, its in-kernel part, opens wrong files ...


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/coda/coda.h
cvs rdiff -u -r1.113 -r1.114 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.



CVS commit: src/sys/coda

2020-11-14 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Nov 14 11:42:05 UTC 2020

Modified Files:
src/sys/coda: coda_vnops.c coda_vnops.h

Log Message:
Add coda_pathconf() always returning EINVAL.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/coda/coda_vnops.c
cvs rdiff -u -r1.16 -r1.17 src/sys/coda/coda_vnops.h

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_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.112 src/sys/coda/coda_vnops.c:1.113
--- src/sys/coda/coda_vnops.c:1.112	Sat May 16 18:31:48 2020
+++ src/sys/coda/coda_vnops.c	Sat Nov 14 11:42:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.112 2020/05/16 18:31:48 christos Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.113 2020/11/14 11:42:05 hannken Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.112 2020/05/16 18:31:48 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.113 2020/11/14 11:42:05 hannken Exp $");
 
 #include 
 #include 
@@ -134,7 +134,7 @@ const struct vnodeopv_entry_desc coda_vn
 { _strategy_desc, coda_strategy },	/* strategy */
 { _print_desc, coda_vop_error },	/* print */
 { _islocked_desc, coda_islocked },	/* islocked */
-{ _pathconf_desc, coda_vop_error },	/* pathconf */
+{ _pathconf_desc, coda_pathconf },	/* pathconf */
 { _advlock_desc, coda_vop_nop },	/* advlock */
 { _bwrite_desc, coda_vop_error },	/* bwrite */
 { _seek_desc, genfs_seek },		/* seek */
@@ -1739,6 +1739,18 @@ coda_islocked(void *v)
 return genfs_islocked(v);
 }
 
+int
+coda_pathconf(void *v)
+{
+	struct vop_pathconf_args *ap = v;
+
+	switch (ap->a_name) {
+	default:
+		return EINVAL;
+	}
+	/* NOTREACHED */
+}
+
 /*
  * Given a device and inode, obtain a locked vnode.  One reference is
  * obtained and passed back to the caller.

Index: src/sys/coda/coda_vnops.h
diff -u src/sys/coda/coda_vnops.h:1.16 src/sys/coda/coda_vnops.h:1.17
--- src/sys/coda/coda_vnops.h:1.16	Thu Aug  2 16:06:59 2012
+++ src/sys/coda/coda_vnops.h	Sat Nov 14 11:42:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.h,v 1.16 2012/08/02 16:06:59 christos Exp $	*/
+/*	$NetBSD: coda_vnops.h,v 1.17 2020/11/14 11:42:05 hannken Exp $	*/
 
 /*
  *
@@ -74,6 +74,7 @@ int coda_reclaim(void *);
 int coda_lock(void *);
 int coda_unlock(void *);
 int coda_islocked(void *);
+int coda_pathconf(void *);
 int coda_vop_error(void *);
 int coda_vop_nop(void *);
 int coda_getpages(void *);



CVS commit: src/sys/coda

2020-11-14 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Nov 14 11:42:56 UTC 2020

Modified Files:
src/sys/coda: coda.h coda_vnops.c

Log Message:
Rewrite coda_readdir() to directly process the container file.

Passing this operation down to the file system holding the container
cannot work for anything but UFS and UFS doesn't allow reading
directory from a plain file since ~2015.

Fixes PR kern/55775 Coda client, its in-kernel part, opens wrong files ...


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/coda/coda.h
cvs rdiff -u -r1.113 -r1.114 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.h
diff -u src/sys/coda/coda.h:1.20 src/sys/coda/coda.h:1.21
--- src/sys/coda/coda.h:1.20	Thu Apr 19 21:50:07 2018
+++ src/sys/coda/coda.h	Sat Nov 14 11:42:56 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: coda.h,v 1.20 2018/04/19 21:50:07 christos Exp $ */
+/* $NetBSD: coda.h,v 1.21 2020/11/14 11:42:56 hannken Exp $ */
 
 /*
 
@@ -61,6 +61,10 @@ Mellon the rights to redistribute these 
 #define CODA_MAXSYMLINKS 10
 #endif
 
+#ifndef CODA_DIRBLKSIZ
+#define CODA_DIRBLKSIZ 0x1000
+#endif
+
 #if defined(DJGPP) || defined(__CYGWIN32__)
 #ifdef KERNEL
 typedef unsigned long u_long;
@@ -169,7 +173,7 @@ struct venus_dirent {
 #ifndef _VENUS_DIRENT_T_
 #define _VENUS_DIRENT_T_ 1
 struct venus_dirent {
-unsigned long	d_fileno;		/* file number of entry */
+unsigned int	d_fileno;		/* file number of entry */
 unsigned short	d_reclen;		/* length of this record */
 unsigned char 	d_type;			/* file type, see below */
 unsigned char	d_namlen;		/* length of string in d_name */

Index: src/sys/coda/coda_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.113 src/sys/coda/coda_vnops.c:1.114
--- src/sys/coda/coda_vnops.c:1.113	Sat Nov 14 11:42:05 2020
+++ src/sys/coda/coda_vnops.c	Sat Nov 14 11:42:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.113 2020/11/14 11:42:05 hannken Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.114 2020/11/14 11:42:56 hannken Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.113 2020/11/14 11:42:05 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.114 2020/11/14 11:42:56 hannken Exp $");
 
 #include 
 #include 
@@ -62,6 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: coda_vnops.c
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1528,70 +1529,143 @@ int
 coda_readdir(void *v)
 {
 /* true args */
-struct vop_readdir_args *ap = v;
-vnode_t *vp = ap->a_vp;
-struct cnode *cp = VTOC(vp);
-struct uio *uiop = ap->a_uio;
-kauth_cred_t cred = ap->a_cred;
-int *eofflag = ap->a_eofflag;
-off_t **cookies = ap->a_cookies;
-int *ncookies = ap->a_ncookies;
+	struct vop_readdir_args *ap = v;
+	vnode_t *vp = ap->a_vp;
+	struct cnode *cp = VTOC(vp);
+	struct uio *uiop = ap->a_uio;
+	kauth_cred_t cred = ap->a_cred;
+	int *eofflag = ap->a_eofflag;
 /* upcall decl */
 /* locals */
-int error = 0;
-enum vtype saved_type;
-
-MARK_ENTRY(CODA_READDIR_STATS);
-
-CODADEBUG(CODA_READDIR, myprintf(("%s: (%p, %lu, %lld)\n", __func__,
-	uiop->uio_iov->iov_base, (unsigned long) uiop->uio_resid,
-	(long long) uiop->uio_offset)); )
-
-/* Check for readdir of control object. */
-if (IS_CTL_VP(vp)) {
-	MARK_INT_FAIL(CODA_READDIR_STATS);
-	return(ENOENT);
-}
+	size_t initial_resid = uiop->uio_resid;
+	int error = 0;
+	int opened_internally = 0;
+	int ncookies;
+	char *buf;
+	struct vnode *cvp;
+	struct dirent *dirp;
+
+	MARK_ENTRY(CODA_READDIR_STATS);
+
+	CODADEBUG(CODA_READDIR, myprintf(("%s: (%p, %lu, %lld)\n", __func__,
+	uiop->uio_iov->iov_base, (unsigned long) uiop->uio_resid,
+	(long long) uiop->uio_offset)); )
 
-{
-	/* Redirect the request to UFS. */
+	/* Check for readdir of control object. */
+	if (IS_CTL_VP(vp)) {
+		MARK_INT_FAIL(CODA_READDIR_STATS);
+		return ENOENT;
+	}
 
 	/* If directory is not already open do an "internal open" on it. */
-	int opened_internally = 0;
 	if (cp->c_ovp == NULL) {
-	opened_internally = 1;
-	MARK_INT_GEN(CODA_OPEN_STATS);
-	error = VOP_OPEN(vp, FREAD, cred);
+		opened_internally = 1;
+		MARK_INT_GEN(CODA_OPEN_STATS);
+		error = VOP_OPEN(vp, FREAD, cred);
 #ifdef	CODA_VERBOSE
-	printf("%s: Internally Opening %p\n", __func__, vp);
+		printf("%s: Internally Opening %p\n", __func__, vp);
 #endif
-	if (error) return(error);
-	} else
-	vp = cp->c_ovp;
+		if (error)
+			return error;
+		KASSERT(cp->c_ovp != NULL);
+	}
+	cvp = cp->c_ovp;
 
-	/* Have UFS handle the call. */
 	CODADEBUG(CODA_READDIR, myprintf(("%s: fid = %s, refcnt = %d\n",
-	__func__, coda_f2s(>c_fid), vrefcnt(vp))); )
-	saved_type = vp->v_type;
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
-	vp->v_type = VDIR; /* pretend the container file is a dir */
-	error = VOP_READDIR(vp, uiop, cred, 

CVS commit: src/sys/coda

2020-11-14 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Nov 14 11:42:05 UTC 2020

Modified Files:
src/sys/coda: coda_vnops.c coda_vnops.h

Log Message:
Add coda_pathconf() always returning EINVAL.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/coda/coda_vnops.c
cvs rdiff -u -r1.16 -r1.17 src/sys/coda/coda_vnops.h

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



CVS commit: src/sys/coda

2020-11-14 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Nov 14 11:41:29 UTC 2020

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

Log Message:
Respect "lktype" in all paths in coda_root().


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/coda/coda_vfsops.c

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



CVS commit: src/sys/coda

2020-11-14 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Nov 14 11:41:29 UTC 2020

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

Log Message:
Respect "lktype" in all paths in coda_root().


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/coda/coda_vfsops.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_vfsops.c
diff -u src/sys/coda/coda_vfsops.c:1.87 src/sys/coda/coda_vfsops.c:1.88
--- src/sys/coda/coda_vfsops.c:1.87	Fri Jan 17 20:08:06 2020
+++ src/sys/coda/coda_vfsops.c	Sat Nov 14 11:41:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vfsops.c,v 1.87 2020/01/17 20:08:06 ad Exp $	*/
+/*	$NetBSD: coda_vfsops.c,v 1.88 2020/11/14 11:41:29 hannken Exp $	*/
 
 /*
  *
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.87 2020/01/17 20:08:06 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.88 2020/11/14 11:41:29 hannken Exp $");
 
 #include 
 #include 
@@ -388,7 +388,7 @@ coda_root(struct mount *vfsp, int lktype
 
 	*vpp = mi->mi_rootvp;
 	vref(*vpp);
-	vn_lock(*vpp, LK_EXCLUSIVE);
+	vn_lock(*vpp, lktype);
 	MARK_INT_SAT(CODA_ROOT_STATS);
 	goto exit;
 } else if (error == ENODEV || error == EINTR) {
@@ -403,7 +403,7 @@ coda_root(struct mount *vfsp, int lktype
 	 */
 	*vpp = mi->mi_rootvp;
 	vref(*vpp);
-	vn_lock(*vpp, LK_EXCLUSIVE);
+	vn_lock(*vpp, lktype);
 	MARK_INT_FAIL(CODA_ROOT_STATS);
 	error = 0;
 	goto exit;



CVS commit: src/sys/coda

2020-02-24 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Mon Feb 24 20:53:11 UTC 2020

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

Log Message:
v_interlock -> vmobjloc


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 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_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.109 src/sys/coda/coda_vnops.c:1.110
--- src/sys/coda/coda_vnops.c:1.109	Sun Feb 23 15:46:39 2020
+++ src/sys/coda/coda_vnops.c	Mon Feb 24 20:53:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.109 2020/02/23 15:46:39 ad Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.110 2020/02/24 20:53:11 ad Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.109 2020/02/23 15:46:39 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.110 2020/02/24 20:53:11 ad Exp $");
 
 #include 
 #include 
@@ -1889,6 +1889,7 @@ coda_getpages(void *v)
 	int error, cerror;
 	int waslocked;	   /* 1 if vnode lock was held on entry */
 	int didopen = 0;	/* 1 if we opened container file */
+	krw_t op;
 
 	/*
 	 * Handle a case that uvm_fault doesn't quite use yet.
@@ -1898,7 +1899,7 @@ coda_getpages(void *v)
 		return EBUSY;
 	}
 
-	KASSERT(mutex_owned(vp->v_interlock));
+	KASSERT(rw_lock_held(vp->v_uobj.vmobjlock));
 
 	/* Check for control object. */
 	if (IS_CTL_VP(vp)) {
@@ -1917,6 +1918,7 @@ coda_getpages(void *v)
 	 * mechanism.
 	 */
 	/* XXX VOP_ISLOCKED() may not be used for lock decisions. */
+	op = rw_lock_op(vp->v_uobj.vmobjlock);
 	waslocked = VOP_ISLOCKED(vp);
 
 	/* Get container file if not already present. */
@@ -1928,7 +1930,7 @@ coda_getpages(void *v)
 		 * leave it in the same state on exit.
 		 */
 		if (waslocked == 0) {
-			mutex_exit(vp->v_interlock);
+			rw_exit(vp->v_uobj.vmobjlock);
 			cerror = vn_lock(vp, LK_EXCLUSIVE);
 			if (cerror) {
 #ifdef CODA_VERBOSE
@@ -1966,12 +1968,12 @@ coda_getpages(void *v)
 		cvp = cp->c_ovp;
 		didopen = 1;
 		if (waslocked == 0)
-			mutex_enter(vp->v_interlock);
+			rw_enter(vp->v_uobj.vmobjlock, op);
 	}
 	KASSERT(cvp != NULL);
 
 	/* Munge the arg structure to refer to the container vnode. */
-	KASSERT(cvp->v_interlock == vp->v_interlock);
+	KASSERT(cvp->v_uobj.vmobjlock == vp->v_uobj.vmobjlock);
 	ap->a_vp = cp->c_ovp;
 
 	/* Finally, call getpages on it. */
@@ -2015,11 +2017,11 @@ coda_putpages(void *v)
 	struct cnode *cp = VTOC(vp);
 	int error;
 
-	KASSERT(mutex_owned(vp->v_interlock));
+	KASSERT(rw_write_held(vp->v_uobj.vmobjlock));
 
 	/* Check for control object. */
 	if (IS_CTL_VP(vp)) {
-		mutex_exit(vp->v_interlock);
+		rw_exit(vp->v_uobj.vmobjlock);
 #ifdef CODA_VERBOSE
 		printf("%s: control object %p\n", __func__, vp);
 #endif
@@ -2034,12 +2036,12 @@ coda_putpages(void *v)
 	 */
 	cvp = cp->c_ovp;
 	if (cvp == NULL) {
-		mutex_exit(vp->v_interlock);
+		rw_exit(vp->v_uobj.vmobjlock);
 		return 0;
 	}
 
 	/* Munge the arg structure to refer to the container vnode. */
-	KASSERT(cvp->v_interlock == vp->v_interlock);
+	KASSERT(cvp->v_uobj.vmobjlock == vp->v_uobj.vmobjlock);
 	ap->a_vp = cvp;
 
 	/* Finally, call putpages on it. */



CVS commit: src/sys/coda

2020-02-24 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Mon Feb 24 20:53:11 UTC 2020

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

Log Message:
v_interlock -> vmobjloc


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 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.



CVS commit: src/sys/coda

2018-11-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Nov 20 19:05:25 UTC 2018

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

Log Message:
Fix locking for readdir code (Brett Lymn)


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 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_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.106 src/sys/coda/coda_vnops.c:1.107
--- src/sys/coda/coda_vnops.c:1.106	Fri May 26 10:21:00 2017
+++ src/sys/coda/coda_vnops.c	Tue Nov 20 14:05:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.106 2017/05/26 14:21:00 riastradh Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.107 2018/11/20 19:05:25 christos Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.106 2017/05/26 14:21:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.107 2018/11/20 19:05:25 christos Exp $");
 
 #include 
 #include 
@@ -1537,6 +1537,7 @@ coda_readdir(void *v)
 /* upcall decl */
 /* locals */
 int error = 0;
+enum vtype saved_type;
 
 MARK_ENTRY(CODA_READDIR_STATS);
 
@@ -1569,7 +1570,13 @@ coda_readdir(void *v)
 	/* Have UFS handle the call. */
 	CODADEBUG(CODA_READDIR, myprintf(("%s: fid = %s, refcnt = %d\n",
 	__func__, coda_f2s(>c_fid), vp->v_usecount)); )
+	saved_type = vp->v_type;
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	vp->v_type = VDIR; /* pretend the container file is a dir */
 	error = VOP_READDIR(vp, uiop, cred, eofflag, cookies, ncookies);
+	vp->v_type = saved_type;
+	VOP_UNLOCK(vp);
+
 	if (error)
 	MARK_INT_FAIL(CODA_READDIR_STATS);
 	else



CVS commit: src/sys/coda

2018-11-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Nov 20 19:05:25 UTC 2018

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

Log Message:
Fix locking for readdir code (Brett Lymn)


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 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.



CVS commit: src/sys/coda

2017-06-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Thu Jun  8 22:29:59 UTC 2017

Modified Files:
src/sys/coda: coda_vfsops.h

Log Message:
add a forward declaration of struct mbuf.
needed due to some other change I made for ZFS.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/coda/coda_vfsops.h

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



CVS commit: src/sys/coda

2017-06-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Thu Jun  8 22:29:59 UTC 2017

Modified Files:
src/sys/coda: coda_vfsops.h

Log Message:
add a forward declaration of struct mbuf.
needed due to some other change I made for ZFS.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/coda/coda_vfsops.h

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_vfsops.h
diff -u src/sys/coda/coda_vfsops.h:1.19 src/sys/coda/coda_vfsops.h:1.20
--- src/sys/coda/coda_vfsops.h:1.19	Sat Dec 13 15:59:30 2014
+++ src/sys/coda/coda_vfsops.h	Thu Jun  8 22:29:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vfsops.h,v 1.19 2014/12/13 15:59:30 hannken Exp $	*/
+/*	$NetBSD: coda_vfsops.h,v 1.20 2017/06/08 22:29:59 chs Exp $	*/
 
 /*
  *
@@ -44,6 +44,7 @@ struct cfid {
 };
 
 struct mount;
+struct mbuf;
 
 int coda_vfsopstats_init(void);
 int coda_mount(struct mount *, const char *, void *, size_t *);



CVS commit: src/sys/coda

2017-04-04 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Apr  4 07:36:38 UTC 2017

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

Log Message:
Use spec_node_lookup_by_dev() and spec_node_getmountedfs() to
retrieve a mount by device.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/coda/coda_vfsops.c

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



CVS commit: src/sys/coda

2017-04-04 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Apr  4 07:36:38 UTC 2017

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

Log Message:
Use spec_node_lookup_by_dev() and spec_node_getmountedfs() to
retrieve a mount by device.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/coda/coda_vfsops.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_vfsops.c
diff -u src/sys/coda/coda_vfsops.c:1.85 src/sys/coda/coda_vfsops.c:1.86
--- src/sys/coda/coda_vfsops.c:1.85	Fri Feb 17 08:31:23 2017
+++ src/sys/coda/coda_vfsops.c	Tue Apr  4 07:36:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vfsops.c,v 1.85 2017/02/17 08:31:23 hannken Exp $	*/
+/*	$NetBSD: coda_vfsops.c,v 1.86 2017/04/04 07:36:38 hannken Exp $	*/
 
 /*
  *
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.85 2017/02/17 08:31:23 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.86 2017/04/04 07:36:38 hannken Exp $");
 
 #include 
 #include 
@@ -624,23 +624,20 @@ getNewVnode(struct vnode **vpp)
 		  NULL, NULL);
 }
 
-#include 
-#include 
-/* get the mount structure corresponding to a given device.  Assume
- * device corresponds to a UFS. Return NULL if no device is found.
+/* Get the mount structure corresponding to a given device.
+ * Return NULL if no device is found or the device is not mounted.
  */
 struct mount *devtomp(dev_t dev)
 {
 struct mount *mp;
+struct vnode *vp;
 
-mutex_enter(_lock);
-TAILQ_FOREACH(mp, , mnt_list) {
-	if ((!strcmp(mp->mnt_op->vfs_name, MOUNT_UFS)) &&
-	((VFSTOUFS(mp))->um_dev == (dev_t) dev)) {
-	/* mount corresponds to UFS and the device matches one we want */
-	break;
-	}
+if (spec_node_lookup_by_dev(VBLK, dev, ) == 0) {
+	mp = spec_node_getmountedfs(vp);
+	vrele(vp);
+} else {
+	mp = NULL;
 }
-mutex_exit(_lock);
+
 return mp;
 }



CVS commit: src/sys/coda

2015-01-06 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Jan  6 11:24:46 UTC 2015

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

Log Message:
Add missing vrele() and vfs_vnode_iterator_destroy() to coda_cacheprint().


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/coda/coda_subr.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.30 src/sys/coda/coda_subr.c:1.31
--- src/sys/coda/coda_subr.c:1.30	Sat Dec 13 15:59:30 2014
+++ src/sys/coda/coda_subr.c	Tue Jan  6 11:24:46 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_subr.c,v 1.30 2014/12/13 15:59:30 hannken Exp $	*/
+/*	$NetBSD: coda_subr.c,v 1.31 2015/01/06 11:24:46 hannken Exp $	*/
 
 /*
  *
@@ -55,7 +55,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_subr.c,v 1.30 2014/12/13 15:59:30 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_subr.c,v 1.31 2015/01/06 11:24:46 hannken Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -297,8 +297,10 @@ coda_cacheprint(struct mount *whoIam)
 		coda_nc_name(VTOC(vp));
 		printf(\n);
 		count++;
+		vrele(vp);
 	}
 	printf(coda_cacheprint: count %d\n, count);
+	vfs_vnode_iterator_destroy(marker);
 }
 #endif
 



CVS commit: src/sys/coda

2015-01-06 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Jan  6 11:24:46 UTC 2015

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

Log Message:
Add missing vrele() and vfs_vnode_iterator_destroy() to coda_cacheprint().


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/coda/coda_subr.c

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



CVS commit: src/sys/coda

2014-12-13 Thread Juergen Hannken-Illjes
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;
 	}
 
 	/*



CVS commit: src/sys/coda

2014-12-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Dec 13 15:58:39 UTC 2014

Modified Files:
src/sys/coda: coda.h coda_psdev.c coda_subr.c coda_vfsops.c

Log Message:
Move the definition of NVCODA and CODA_COMPAT_5 to coda.h,
remove them from coda_vfsops.c and coda_psdev.c.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/coda/coda.h
cvs rdiff -u -r1.53 -r1.54 src/sys/coda/coda_psdev.c
cvs rdiff -u -r1.28 -r1.29 src/sys/coda/coda_subr.c
cvs rdiff -u -r1.82 -r1.83 src/sys/coda/coda_vfsops.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.h
diff -u src/sys/coda/coda.h:1.17 src/sys/coda/coda.h:1.18
--- src/sys/coda/coda.h:1.17	Sat Aug  7 20:39:33 2010
+++ src/sys/coda/coda.h	Sat Dec 13 15:58:39 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: coda.h,v 1.17 2010/08/07 20:39:33 christos Exp $ */
+/* $NetBSD: coda.h,v 1.18 2014/12/13 15:58:39 hannken Exp $ */
 
 /*
 
@@ -39,9 +39,14 @@ Mellon the rights to redistribute these 
 #ifndef _CODA_HEADER_
 #define _CODA_HEADER_
 
-#if defined(__NetBSD__)  defined(_KERNEL_OPT)
-/* pull in optional CODA_COMPAT_5 flag */
+#if defined(__NetBSD__)
+#if defined(_KERNEL_OPT)
+/* pull in optional CODA_COMPAT_5 flag and NVCODA. */
 #include opt_coda_compat.h
+#include vcoda.h
+#else
+#define NVCODA 4
+#endif
 #endif
 
 /* Catch new _KERNEL defn for NetBSD and DJGPP/__CYGWIN32__ */

Index: src/sys/coda/coda_psdev.c
diff -u src/sys/coda/coda_psdev.c:1.53 src/sys/coda/coda_psdev.c:1.54
--- src/sys/coda/coda_psdev.c:1.53	Fri Jul 25 08:10:35 2014
+++ src/sys/coda/coda_psdev.c	Sat Dec 13 15:58:39 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_psdev.c,v 1.53 2014/07/25 08:10:35 dholland Exp $	*/
+/*	$NetBSD: coda_psdev.c,v 1.54 2014/12/13 15:58:39 hannken Exp $	*/
 
 /*
  *
@@ -54,16 +54,10 @@
 /* These routines are the device entry points for Venus. */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_psdev.c,v 1.53 2014/07/25 08:10:35 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_psdev.c,v 1.54 2014/12/13 15:58:39 hannken Exp $);
 
 extern int coda_nc_initialized;/* Set if cache has been initialized */
 
-#ifndef _KERNEL_OPT
-#define	NVCODA 4
-#else
-#include vcoda.h
-#endif
-
 #include sys/param.h
 #include sys/systm.h
 #include sys/kernel.h

Index: src/sys/coda/coda_subr.c
diff -u src/sys/coda/coda_subr.c:1.28 src/sys/coda/coda_subr.c:1.29
--- src/sys/coda/coda_subr.c:1.28	Sat Dec 13 15:57:46 2014
+++ src/sys/coda/coda_subr.c	Sat Dec 13 15:58:39 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_subr.c,v 1.28 2014/12/13 15:57:46 hannken Exp $	*/
+/*	$NetBSD: coda_subr.c,v 1.29 2014/12/13 15:58:39 hannken Exp $	*/
 
 /*
  *
@@ -55,7 +55,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_subr.c,v 1.28 2014/12/13 15:57:46 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_subr.c,v 1.29 2014/12/13 15:58:39 hannken Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -70,9 +70,6 @@ __KERNEL_RCSID(0, $NetBSD: coda_subr.c,
 #include coda/coda_subr.h
 #include coda/coda_namecache.h
 
-#ifdef _KERNEL_OPT
-#include opt_coda_compat.h
-#endif
 
 int coda_active = 0;
 int coda_reuse = 0;

Index: src/sys/coda/coda_vfsops.c
diff -u src/sys/coda/coda_vfsops.c:1.82 src/sys/coda/coda_vfsops.c:1.83
--- src/sys/coda/coda_vfsops.c:1.82	Sat Dec 13 15:57:46 2014
+++ src/sys/coda/coda_vfsops.c	Sat Dec 13 15:58:39 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vfsops.c,v 1.82 2014/12/13 15:57:46 hannken Exp $	*/
+/*	$NetBSD: coda_vfsops.c,v 1.83 2014/12/13 15:58:39 hannken Exp $	*/
 
 /*
  *
@@ -45,13 +45,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_vfsops.c,v 1.82 2014/12/13 15:57:46 hannken Exp $);
-
-#ifndef _KERNEL_OPT
-#define	NVCODA 4
-#else
-#include vcoda.h
-#endif
+__KERNEL_RCSID(0, $NetBSD: coda_vfsops.c,v 1.83 2014/12/13 15:58:39 hannken Exp $);
 
 #include sys/param.h
 #include sys/systm.h



CVS commit: src/sys/coda

2014-12-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Dec 13 15:58:13 UTC 2014

Modified Files:
src/sys/coda: cnode.h

Log Message:
Remove unused definitions (C_WANTED, C_LOCKED).


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/coda/cnode.h

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/cnode.h
diff -u src/sys/coda/cnode.h:1.18 src/sys/coda/cnode.h:1.19
--- src/sys/coda/cnode.h:1.18	Fri May  4 01:38:56 2012
+++ src/sys/coda/cnode.h	Sat Dec 13 15:58:13 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cnode.h,v 1.18 2012/05/04 01:38:56 christos Exp $	*/
+/*	$NetBSD: cnode.h,v 1.19 2014/12/13 15:58:13 hannken Exp $	*/
 
 /*
  *
@@ -115,8 +115,6 @@ struct cnode {
 /* flags */
 #define C_VATTR		0x01	/* Validity of vattr in the cnode */
 #define C_SYMLINK	0x02	/* Validity of symlink pointer in the Code */
-#define C_WANTED	0x08	/* Set if lock wanted */
-#define C_LOCKED	0x10	/* Set if lock held */
 #define C_UNMOUNTING	0X20	/* Set if unmounting */
 #define C_PURGING	0x40	/* Set if purging a fid */
 



CVS commit: src/sys/coda

2014-12-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Dec 13 15:59:03 UTC 2014

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

Log Message:
Remove cnodes from coda_reclaim(), not from coda_inactive().


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 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_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.99 src/sys/coda/coda_vnops.c:1.100
--- src/sys/coda/coda_vnops.c:1.99	Sat Dec 13 15:57:46 2014
+++ src/sys/coda/coda_vnops.c	Sat Dec 13 15:59:03 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.99 2014/12/13 15:57:46 hannken Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.100 2014/12/13 15:59:03 hannken Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.99 2014/12/13 15:57:46 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.100 2014/12/13 15:59:03 hannken Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -844,18 +844,6 @@ coda_inactive(void *v)
 CODADEBUG(CODA_INACTIVE, myprintf((in inactive, %s, vfsp %p\n,
   coda_f2s(cp-c_fid), vp-v_mount));)
 
-/* If an array has been allocated to hold the symlink, deallocate it */
-if ((coda_symlink_cache)  (VALID_SYMLINK(cp))) {
-	if (cp-c_symlink == NULL)
-	panic(%s: null symlink pointer in cnode, __func__);
-
-	CODA_FREE(cp-c_symlink, cp-c_symlen);
-	cp-c_flags = ~C_SYMLINK;
-	cp-c_symlen = 0;
-}
-
-/* Remove it from the table so it can't be found. */
-coda_unsave(cp);
 if (vp-v_mount-mnt_data == NULL) {
 	myprintf((Help! vfsp-vfs_data was NULL, but vnode %p wasn't dying\n, vp));
 	panic(badness in coda_inactive);
@@ -1676,6 +1664,18 @@ coda_reclaim(void *v)
 	}
 #endif
 }
+/* If an array has been allocated to hold the symlink, deallocate it */
+if ((coda_symlink_cache)  (VALID_SYMLINK(cp))) {
+	if (cp-c_symlink == NULL)
+	panic(%s: null symlink pointer in cnode, __func__);
+
+	CODA_FREE(cp-c_symlink, cp-c_symlen);
+	cp-c_flags = ~C_SYMLINK;
+	cp-c_symlen = 0;
+}
+
+/* Remove it from the table so it can't be found. */
+coda_unsave(cp);
 coda_free(VTOC(vp));
 SET_VTOC(vp) = NULL;
 return (0);



CVS commit: src/sys/coda

2014-12-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Dec 13 15:59:30 UTC 2014

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

Log Message:
Change coda from hashlist to vcache.
- Replace all hash list crawlers with vfs_vnode_iterator.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/coda/cnode.h
cvs rdiff -u -r1.29 -r1.30 src/sys/coda/coda_subr.c
cvs rdiff -u -r1.83 -r1.84 src/sys/coda/coda_vfsops.c
cvs rdiff -u -r1.18 -r1.19 src/sys/coda/coda_vfsops.h
cvs rdiff -u -r1.100 -r1.101 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/cnode.h
diff -u src/sys/coda/cnode.h:1.19 src/sys/coda/cnode.h:1.20
--- src/sys/coda/cnode.h:1.19	Sat Dec 13 15:58:13 2014
+++ src/sys/coda/cnode.h	Sat Dec 13 15:59:30 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cnode.h,v 1.19 2014/12/13 15:58:13 hannken Exp $	*/
+/*	$NetBSD: cnode.h,v 1.20 2014/12/13 15:59:30 hannken Exp $	*/
 
 /*
  *
@@ -106,7 +106,7 @@ struct cnode {
 u_short		 c_symlen;	/* length of symbolic link */
 dev_t		 c_device;	/* associated vnode device */
 ino_t		 c_inode;	/* associated vnode inode */
-struct cnode	*c_next;	/* links if on NetBSD machine */
+kmutex_t		 c_lock;
 };
 #define	VTOC(vp)	((struct cnode *)(vp)-v_data)
 #define	SET_VTOC(vp)	((vp)-v_data)

Index: src/sys/coda/coda_subr.c
diff -u src/sys/coda/coda_subr.c:1.29 src/sys/coda/coda_subr.c:1.30
--- src/sys/coda/coda_subr.c:1.29	Sat Dec 13 15:58:39 2014
+++ src/sys/coda/coda_subr.c	Sat Dec 13 15:59:30 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_subr.c,v 1.29 2014/12/13 15:58:39 hannken Exp $	*/
+/*	$NetBSD: coda_subr.c,v 1.30 2014/12/13 15:59:30 hannken Exp $	*/
 
 /*
  *
@@ -55,7 +55,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_subr.c,v 1.29 2014/12/13 15:58:39 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_subr.c,v 1.30 2014/12/13 15:59:30 hannken Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -70,22 +70,11 @@ __KERNEL_RCSID(0, $NetBSD: coda_subr.c,
 #include coda/coda_subr.h
 #include coda/coda_namecache.h
 
-
-int coda_active = 0;
-int coda_reuse = 0;
-int coda_new = 0;
-
-struct cnode *coda_freelist = NULL;
-struct cnode *coda_cache[CODA_CACHESIZE];
-MALLOC_DEFINE(M_CODA, coda, Coda file system structures and tables);
-
 int codadebug = 0;
 int coda_printf_delay = 0;  /* in microseconds */
 int coda_vnop_print_entry = 0;
 int coda_vfsop_print_entry = 0;
 
-#define	CNODE_NEXT(cp)	((cp)-c_next)
-
 #ifdef CODA_COMPAT_5
 #define coda_hash(fid) \
 (((fid)-Volume + (fid)-Vnode)  (CODA_CACHESIZE-1))
@@ -99,99 +88,56 @@ int coda_vfsop_print_entry = 0;
 struct vnode *coda_ctlvp;
 
 /*
- * Allocate a cnode.
+ * Lookup a cnode by fid. If the cnode is dying, it is bogus so skip it.
+ * The cnode is returned locked with the vnode referenced.
  */
 struct cnode *
-coda_alloc(void)
+coda_find(CodaFid *fid)
 {
-struct cnode *cp;
-
-if (coda_freelist) {
-	cp = coda_freelist;
-	coda_freelist = CNODE_NEXT(cp);
-	coda_reuse++;
-}
-else {
-	CODA_ALLOC(cp, struct cnode *, sizeof(struct cnode));
-	/* NetBSD vnodes don't have any Pager info in them ('cause there are
-	   no external pagers, duh!) */
-#define VNODE_VM_INFO_INIT(vp) /* MT */
-	VNODE_VM_INFO_INIT(CTOV(cp));
-	coda_new++;
-}
-memset(cp, 0, sizeof (struct cnode));
+	int i;
+	struct vnode *vp;
+	struct cnode *cp;
 
-return(cp);
-}
+	for (i = 0; i  NVCODA; i++) {
+		if (!coda_mnttbl[i].mi_started)
+			continue;
+		if (vcache_get(coda_mnttbl[i].mi_vfsp,
+		fid, sizeof(CodaFid), vp) != 0)
+			continue;
+		mutex_enter(vp-v_interlock);
+		cp = VTOC(vp);
+		if (vp-v_type == VNON || cp == NULL || IS_UNMOUNTING(cp)) {
+			mutex_exit(vp-v_interlock);
+			vrele(vp);
+			continue;
+		}
+		mutex_enter(cp-c_lock);
+		mutex_exit(vp-v_interlock);
 
-/*
- * Deallocate a cnode.
- */
-void
-coda_free(struct cnode *cp)
-{
+		return cp;
+	}
 
-CNODE_NEXT(cp) = coda_freelist;
-coda_freelist = cp;
+	return NULL;
 }
 
 /*
- * Put a cnode in the hash table
+ * Iterate over all nodes attached to coda mounts.
  */
-void
-coda_save(struct cnode *cp)
+static void
+coda_iterate(bool (*f)(void *, struct vnode *), void *cl)
 {
-	CNODE_NEXT(cp) = coda_cache[coda_hash(cp-c_fid)];
-	coda_cache[coda_hash(cp-c_fid)] = cp;
-}
-
-/*
- * Remove a cnode from the hash table
- */
-void
-coda_unsave(struct cnode *cp)
-{
-struct cnode *ptr;
-struct cnode *ptrprev = NULL;
-
-ptr = coda_cache[coda_hash(cp-c_fid)];
-while (ptr != NULL) {
-	if (ptr == cp) {
-	if (ptrprev == NULL) {
-		coda_cache[coda_hash(cp-c_fid)]
-		= CNODE_NEXT(ptr);
-	} else {
-		CNODE_NEXT(ptrprev) = CNODE_NEXT(ptr);
-	}
-	CNODE_NEXT(cp) = NULL;
+	int i;
+	struct vnode_iterator *marker;
+	struct vnode *vp;
 
-	return;
+	for (i = 0; i  NVCODA; i++) { 
+		if (coda_mnttbl[i].mi_vfsp == 

CVS commit: src/sys/coda

2014-12-13 Thread Juergen Hannken-Illjes
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.



CVS commit: src/sys/coda

2014-12-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Dec 13 15:58:13 UTC 2014

Modified Files:
src/sys/coda: cnode.h

Log Message:
Remove unused definitions (C_WANTED, C_LOCKED).


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/coda/cnode.h

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



CVS commit: src/sys/coda

2014-12-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Dec 13 15:58:39 UTC 2014

Modified Files:
src/sys/coda: coda.h coda_psdev.c coda_subr.c coda_vfsops.c

Log Message:
Move the definition of NVCODA and CODA_COMPAT_5 to coda.h,
remove them from coda_vfsops.c and coda_psdev.c.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/coda/coda.h
cvs rdiff -u -r1.53 -r1.54 src/sys/coda/coda_psdev.c
cvs rdiff -u -r1.28 -r1.29 src/sys/coda/coda_subr.c
cvs rdiff -u -r1.82 -r1.83 src/sys/coda/coda_vfsops.c

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



CVS commit: src/sys/coda

2014-12-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Dec 13 15:59:03 UTC 2014

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

Log Message:
Remove cnodes from coda_reclaim(), not from coda_inactive().


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 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.



CVS commit: src/sys/coda

2014-12-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Dec 13 15:59:30 UTC 2014

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

Log Message:
Change coda from hashlist to vcache.
- Replace all hash list crawlers with vfs_vnode_iterator.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/coda/cnode.h
cvs rdiff -u -r1.29 -r1.30 src/sys/coda/coda_subr.c
cvs rdiff -u -r1.83 -r1.84 src/sys/coda/coda_vfsops.c
cvs rdiff -u -r1.18 -r1.19 src/sys/coda/coda_vfsops.h
cvs rdiff -u -r1.100 -r1.101 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.



Re: CVS commit: src/sys/coda

2013-11-23 Thread Mindaugas Rasiukevicius
Christos Zoulas chris...@netbsd.org wrote:
 Module Name:  src
 Committed By: christos
 Date: Sat Nov 23 17:57:23 UTC 2013
 
 Modified Files:
   src/sys/coda: coda_vfsops.c
 
 Log Message:
 replace open-coded scan with macro; fix locking
 

-/* mount structure wasn't found */
-return(NULL);
+mutex_exit(mountlist_lock);
+return mp == TAILQ_END(mountlist) ? NULL : mp;

Although this is correct, TAILQ_END(mountlist) *suggests* access of
mountlist.  If it would be true, it would be unlocked and buggy access.
Why not just return mp; ?

It seems to me that TAILQ_END() makes the code more missleading without
doing any good.  What was the rationale behind adding and using it?

-- 
Mindaugas


Re: CVS commit: src/sys/coda

2013-11-23 Thread Christos Zoulas
On Nov 23,  6:14pm, rm...@netbsd.org (Mindaugas Rasiukevicius) wrote:
-- Subject: Re: CVS commit: src/sys/coda

| Although this is correct, TAILQ_END(mountlist) *suggests* access of
| mountlist.  If it would be true, it would be unlocked and buggy access.
| Why not just return mp; ?
| 
| It seems to me that TAILQ_END() makes the code more missleading without
| doing any good.  What was the rationale behind adding and using it?

I think it was provided so that the macros look the same across different
ADT's. Don't shoot the messenger, I did not add it. But I will fix the
locking non-issue...

christos


Re: CVS commit: src/sys/coda

2013-11-23 Thread Mindaugas Rasiukevicius
chris...@zoulas.com (Christos Zoulas) wrote:
 On Nov 23,  6:14pm, rm...@netbsd.org (Mindaugas Rasiukevicius) wrote:
 -- Subject: Re: CVS commit: src/sys/coda
 
 | Although this is correct, TAILQ_END(mountlist) *suggests* access of
 | mountlist.  If it would be true, it would be unlocked and buggy access.
 | Why not just return mp; ?
 | 
 | It seems to me that TAILQ_END() makes the code more missleading without
 | doing any good.  What was the rationale behind adding and using it?
 
 I think it was provided so that the macros look the same across different
 ADT's. Don't shoot the messenger, I did not add it. But I will fix the
 locking non-issue...

Revision 1.54 of queue.h shows you.  Thanks for improving it, but I still
do not see the benefit of:

mp = mp == TAILQ_END(mountlist) ? NULL : mp;

Over:

return mp;

Everybody understood NULL, so why obfuscate the code?

-- 
Mindaugas


Re: CVS commit: src/sys/coda

2013-11-23 Thread Christos Zoulas
On Nov 23, 11:24pm, rm...@netbsd.org (Mindaugas Rasiukevicius) wrote:
-- Subject: Re: CVS commit: src/sys/coda

| mp = mp == TAILQ_END(mountlist) ? NULL : mp;
| 
| Over:
| 
| return mp;
| 
| Everybody understood NULL, so why obfuscate the code?

The point (as I understand it) is so that if you want to change to another
ADT where end != NULL (are there any now, that we have banned CIRCLEQ?)
using the END macro lets you s/FOOQ/BARQ/ and have it mostly work.

christos


Re: CVS commit: src/sys/coda

2013-11-23 Thread Mindaugas Rasiukevicius
chris...@zoulas.com (Christos Zoulas) wrote:
 On Nov 23, 11:24pm, rm...@netbsd.org (Mindaugas Rasiukevicius) wrote:
 -- Subject: Re: CVS commit: src/sys/coda
 
 | mp = mp == TAILQ_END(mountlist) ? NULL : mp;
 | 
 | Over:
 | 
 | return mp;
 | 
 | Everybody understood NULL, so why obfuscate the code?
 
 The point (as I understand it) is so that if you want to change to another
 ADT where end != NULL (are there any now, that we have banned CIRCLEQ?)
 using the END macro lets you s/FOOQ/BARQ/ and have it mostly work.

Since 1990s (or even earlier) none of the lists in queue(3) had _END(),
apart from the circle queue (for a very obvious reason it makes sense).
Now that CIRCLEQ is banned - you added _END() for LIST and TAILQ.  I do
not follow the logic. :)

I would remove _END() macros to keep the way it always was.  If the goal
is to improve the interface, then now is a good time to design a new API,
but we already have a long thread on tech-userlevel for this..

-- 
Mindaugas


Re: CVS commit: src/sys/coda

2013-11-23 Thread Christos Zoulas
In article 20131123234556.1b4ac14a...@mail.netbsd.org,
Mindaugas Rasiukevicius  rm...@netbsd.org wrote:
chris...@zoulas.com (Christos Zoulas) wrote:
 On Nov 23, 11:24pm, rm...@netbsd.org (Mindaugas Rasiukevicius) wrote:
 -- Subject: Re: CVS commit: src/sys/coda
 
 | mp = mp == TAILQ_END(mountlist) ? NULL : mp;
 | 
 | Over:
 | 
 | return mp;
 | 
 | Everybody understood NULL, so why obfuscate the code?
 
 The point (as I understand it) is so that if you want to change to another
 ADT where end != NULL (are there any now, that we have banned CIRCLEQ?)
 using the END macro lets you s/FOOQ/BARQ/ and have it mostly work.

Since 1990s (or even earlier) none of the lists in queue(3) had _END(),
apart from the circle queue (for a very obvious reason it makes sense).
Now that CIRCLEQ is banned - you added _END() for LIST and TAILQ.  I do
not follow the logic. :)

*I* did appear do be adding it from the commit message, but in reality
I was syncing with OpenBSD/FreeBSD.

I would remove _END() macros to keep the way it always was.

Perhaps that's a good idea now that it is always NULL.

If the goal
is to improve the interface, then now is a good time to design a new API,
but we already have a long thread on tech-userlevel for this..

Yes, so let's leave it the way it is now, and we'll make all the changes
in one go.

christos



CVS commit: src/sys/coda

2013-11-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov 23 17:57:23 UTC 2013

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

Log Message:
replace open-coded scan with macro; fix locking


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/coda/coda_vfsops.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_vfsops.c
diff -u src/sys/coda/coda_vfsops.c:1.75 src/sys/coda/coda_vfsops.c:1.76
--- src/sys/coda/coda_vfsops.c:1.75	Sat Nov 23 11:15:24 2013
+++ src/sys/coda/coda_vfsops.c	Sat Nov 23 12:57:23 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vfsops.c,v 1.75 2013/11/23 16:15:24 riz Exp $	*/
+/*	$NetBSD: coda_vfsops.c,v 1.76 2013/11/23 17:57:23 christos Exp $	*/
 
 /*
  *
@@ -45,7 +45,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_vfsops.c,v 1.75 2013/11/23 16:15:24 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_vfsops.c,v 1.76 2013/11/23 17:57:23 christos Exp $);
 
 #ifndef _KERNEL_OPT
 #define	NVCODA 4
@@ -613,16 +613,16 @@ getNewVnode(struct vnode **vpp)
  */
 struct mount *devtomp(dev_t dev)
 {
-struct mount *mp, *nmp;
+struct mount *mp;
 
-for (mp = mountlist.tqh_first; mp != (void*)mountlist; mp = nmp) {
-	nmp = mp-mnt_list.tqe_next;
+mutex_enter(mountlist_lock);
+TAILQ_FOREACH(mp, mountlist, mnt_list) {
 	if ((!strcmp(mp-mnt_op-vfs_name, MOUNT_UFS)) 
 	((VFSTOUFS(mp))-um_dev == (dev_t) dev)) {
 	/* mount corresponds to UFS and the device matches one we want */
-	return(mp);
+	break;
 	}
 }
-/* mount structure wasn't found */
-return(NULL);
+mutex_exit(mountlist_lock);
+return mp == TAILQ_END(mountlist) ? NULL : mp;
 }



CVS commit: src/sys/coda

2013-11-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov 23 23:14:55 UTC 2013

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

Log Message:
tuck in code inside the mutex


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/coda/coda_vfsops.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_vfsops.c
diff -u src/sys/coda/coda_vfsops.c:1.76 src/sys/coda/coda_vfsops.c:1.77
--- src/sys/coda/coda_vfsops.c:1.76	Sat Nov 23 12:57:23 2013
+++ src/sys/coda/coda_vfsops.c	Sat Nov 23 18:14:55 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vfsops.c,v 1.76 2013/11/23 17:57:23 christos Exp $	*/
+/*	$NetBSD: coda_vfsops.c,v 1.77 2013/11/23 23:14:55 christos Exp $	*/
 
 /*
  *
@@ -45,7 +45,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_vfsops.c,v 1.76 2013/11/23 17:57:23 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_vfsops.c,v 1.77 2013/11/23 23:14:55 christos Exp $);
 
 #ifndef _KERNEL_OPT
 #define	NVCODA 4
@@ -623,6 +623,7 @@ struct mount *devtomp(dev_t dev)
 	break;
 	}
 }
+mp = mp == TAILQ_END(mountlist) ? NULL : mp;
 mutex_exit(mountlist_lock);
-return mp == TAILQ_END(mountlist) ? NULL : mp;
+return mp;
 }



CVS commit: src/sys/coda

2013-11-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov 23 17:57:23 UTC 2013

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

Log Message:
replace open-coded scan with macro; fix locking


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/coda/coda_vfsops.c

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



CVS commit: src/sys/coda

2013-11-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov 23 23:14:55 UTC 2013

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

Log Message:
tuck in code inside the mutex


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/coda/coda_vfsops.c

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



CVS commit: src/sys/coda

2013-10-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 17 20:54:24 UTC 2013

Modified Files:
src/sys/coda: coda_psdev.c

Log Message:
move module code inside module ifdef


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/coda/coda_psdev.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_psdev.c
diff -u src/sys/coda/coda_psdev.c:1.49 src/sys/coda/coda_psdev.c:1.50
--- src/sys/coda/coda_psdev.c:1.49	Sat Aug  4 08:31:57 2012
+++ src/sys/coda/coda_psdev.c	Thu Oct 17 16:54:24 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_psdev.c,v 1.49 2012/08/04 12:31:57 christos Exp $	*/
+/*	$NetBSD: coda_psdev.c,v 1.50 2013/10/17 20:54:24 christos Exp $	*/
 
 /*
  *
@@ -54,7 +54,7 @@
 /* These routines are the device entry points for Venus. */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_psdev.c,v 1.49 2012/08/04 12:31:57 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_psdev.c,v 1.50 2013/10/17 20:54:24 christos Exp $);
 
 extern int coda_nc_initialized;/* Set if cache has been initialized */
 
@@ -730,15 +730,15 @@ MODULE(MODULE_CLASS_DRIVER, vcoda, NULL)
 static int
 vcoda_modcmd(modcmd_t cmd, void *arg)
 {
-	int cmajor, dmajor, error = 0;
-
-	dmajor = cmajor = -1;
+	int error = 0;
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:
 #ifdef _MODULE
+		int cmajor, dmajor;
 		vcodaattach(NVCODA);
 
+		dmajor = cmajor = -1;
 		return devsw_attach(vcoda, NULL, dmajor,
 		vcoda_cdevsw, cmajor);
 #endif



CVS commit: src/sys/coda

2013-10-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 17 20:55:31 UTC 2013

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

Log Message:
remove unused code.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 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_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.90 src/sys/coda/coda_vnops.c:1.91
--- src/sys/coda/coda_vnops.c:1.90	Thu Aug  2 12:06:58 2012
+++ src/sys/coda/coda_vnops.c	Thu Oct 17 16:55:30 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.90 2012/08/02 16:06:58 christos Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.91 2013/10/17 20:55:30 christos Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.90 2012/08/02 16:06:58 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.91 2013/10/17 20:55:30 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -897,7 +897,6 @@ coda_lookup(void *v)
 const char *nm = cnp-cn_nameptr;
 int len = cnp-cn_namelen;
 int flags = cnp-cn_flags;
-int isdot;
 CodaFid VFid;
 int	vtype;
 int error = 0;
@@ -937,13 +936,6 @@ coda_lookup(void *v)
 }
 
 /*
- * XXX Check for DOT lookups, and short circuit all the caches,
- * just doing an extra vref.  (venus guarantees that lookup of
- * . returns self.)
- */
-isdot = (len == 1  nm[0] == '.');
-
-/*
  * Try to resolve the lookup in the minicache.  If that fails, ask
  * venus to do the lookup.  XXX The interaction between vnode
  * locking and any locking that coda does is not clear.



CVS commit: src/sys/coda

2013-10-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 17 20:56:02 UTC 2013

Modified Files:
src/sys/coda: coda_venus.c

Log Message:
remove unused code from macro


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/coda/coda_venus.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_venus.c
diff -u src/sys/coda/coda_venus.c:1.29 src/sys/coda/coda_venus.c:1.30
--- src/sys/coda/coda_venus.c:1.29	Wed Apr 25 23:04:54 2012
+++ src/sys/coda/coda_venus.c	Thu Oct 17 16:56:02 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_venus.c,v 1.29 2012/04/26 03:04:54 christos Exp $	*/
+/*	$NetBSD: coda_venus.c,v 1.30 2013/10/17 20:56:02 christos Exp $	*/
 
 /*
  *
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_venus.c,v 1.29 2012/04/26 03:04:54 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_venus.c,v 1.30 2013/10/17 20:56:02 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -79,7 +79,6 @@ __KERNEL_RCSID(0, $NetBSD: coda_venus.c
 
 #define DECL_NO_OUT(name)\
 struct name ## _in *inp;\
-struct coda_out_hdr *outp;\
 int name ## _size = sizeof (struct name ## _in);	\
 int Isize = sizeof (struct name ## _in);		\
 int Osize = sizeof (struct coda_out_hdr);		\
@@ -101,7 +100,6 @@ __KERNEL_RCSID(0, $NetBSD: coda_venus.c
 if (Osize  name ## _size)\
 	name ## _size = Osize;\
 CODA_ALLOC(inp, struct name ## _in *, name ## _size);\
-outp = (struct coda_out_hdr *) inp
 
 #define STRCPY(struc, name, len) \
 memcpy((char *)inp + (int)inp-struc, name, len); \



CVS commit: src/sys/coda

2013-10-17 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Oct 18 00:03:35 UTC 2013

Modified Files:
src/sys/coda: coda_psdev.c

Log Message:
C requires a statement after a label, and a declaration is not a
statement, so create a block using {}.  From christos.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/coda/coda_psdev.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_psdev.c
diff -u src/sys/coda/coda_psdev.c:1.50 src/sys/coda/coda_psdev.c:1.51
--- src/sys/coda/coda_psdev.c:1.50	Thu Oct 17 20:54:24 2013
+++ src/sys/coda/coda_psdev.c	Fri Oct 18 00:03:35 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_psdev.c,v 1.50 2013/10/17 20:54:24 christos Exp $	*/
+/*	$NetBSD: coda_psdev.c,v 1.51 2013/10/18 00:03:35 riz Exp $	*/
 
 /*
  *
@@ -54,7 +54,7 @@
 /* These routines are the device entry points for Venus. */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_psdev.c,v 1.50 2013/10/17 20:54:24 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_psdev.c,v 1.51 2013/10/18 00:03:35 riz Exp $);
 
 extern int coda_nc_initialized;/* Set if cache has been initialized */
 
@@ -735,12 +735,14 @@ vcoda_modcmd(modcmd_t cmd, void *arg)
 	switch (cmd) {
 	case MODULE_CMD_INIT:
 #ifdef _MODULE
+	{
 		int cmajor, dmajor;
 		vcodaattach(NVCODA);
 
 		dmajor = cmajor = -1;
 		return devsw_attach(vcoda, NULL, dmajor,
 		vcoda_cdevsw, cmajor);
+	}
 #endif
 		break;
 



CVS commit: src/sys/coda

2013-10-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 17 20:54:24 UTC 2013

Modified Files:
src/sys/coda: coda_psdev.c

Log Message:
move module code inside module ifdef


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/coda/coda_psdev.c

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



CVS commit: src/sys/coda

2013-10-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 17 20:55:31 UTC 2013

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

Log Message:
remove unused code.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 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.



CVS commit: src/sys/coda

2013-10-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 17 20:56:02 UTC 2013

Modified Files:
src/sys/coda: coda_venus.c

Log Message:
remove unused code from macro


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/coda/coda_venus.c

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



CVS commit: src/sys/coda

2013-10-17 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Oct 18 00:03:35 UTC 2013

Modified Files:
src/sys/coda: coda_psdev.c

Log Message:
C requires a statement after a label, and a declaration is not a
statement, so create a block using {}.  From christos.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/coda/coda_psdev.c

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



CVS commit: src/sys/coda

2012-08-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug  4 12:31:57 UTC 2012

Modified Files:
src/sys/coda: coda_psdev.c

Log Message:
Don't increment the mount reference count here. Otherwise we are left with
refcount of one when we unmount, and vfs_destroy does not... Who is expected
to decrement this anyway?!?!


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/coda/coda_psdev.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_psdev.c
diff -u src/sys/coda/coda_psdev.c:1.48 src/sys/coda/coda_psdev.c:1.49
--- src/sys/coda/coda_psdev.c:1.48	Wed Apr 25 23:04:54 2012
+++ src/sys/coda/coda_psdev.c	Sat Aug  4 08:31:57 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_psdev.c,v 1.48 2012/04/26 03:04:54 christos Exp $	*/
+/*	$NetBSD: coda_psdev.c,v 1.49 2012/08/04 12:31:57 christos Exp $	*/
 
 /*
  *
@@ -54,7 +54,7 @@
 /* These routines are the device entry points for Venus. */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_psdev.c,v 1.48 2012/04/26 03:04:54 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_psdev.c,v 1.49 2012/08/04 12:31:57 christos Exp $);
 
 extern int coda_nc_initialized;/* Set if cache has been initialized */
 
@@ -202,7 +202,6 @@ vc_nb_close(dev_t dev, int flag, int mod
 }
 
 /* Let unmount know this is for real */
-atomic_inc_uint(mi-mi_vfsp-mnt_refcnt);
 VTOC(mi-mi_rootvp)-c_flags |= C_UNMOUNTING;
 coda_unmounting(mi-mi_vfsp);
 



CVS commit: src/sys/coda

2012-08-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug  4 12:47:00 UTC 2012

Modified Files:
src/sys/coda: README

Log Message:
mention current status


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/coda/README

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/README
diff -u src/sys/coda/README:1.3 src/sys/coda/README:1.4
--- src/sys/coda/README:1.3	Sun Apr  8 09:50:51 2007
+++ src/sys/coda/README	Sat Aug  4 08:47:00 2012
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.3 2007/04/08 13:50:51 gdt Exp $
+$NetBSD: README,v 1.4 2012/08/04 12:47:00 christos Exp $
 
 Coda is a distributed filesystem.  It is derived from AFS, but
 supports disconnected operation, both reading and writing.  This
@@ -11,14 +11,22 @@ Coda servers do not need kernel support.
 For information on Coda, see
   http://www.coda.cs.cmu.edu
 
-As of April 2007, Coda is not quite stable enough for demanding
-production use, but is usable by those who are willing to deal with
-problems.  Help can be obtained via the list codal...@coda.cs.cmu.edu.
-
-As of April 2007, pkgsrc/net/coda\* is old, and gdt recommends running
-code from Coda's CVS.
-
-As of April 2007, the kernel code has not been tested on 64-bit
-architectures.  It runs on i386 and has previously been tested on
-sparc.
+As of Sat Aug  4 15:45:27 EEST 2012
+	- The coda/vcoda modules have been tested for read/write
+	  operations and load/unload on amd64 with a DEBUG/DIAGNOSTIC
+	  kernel and there are no locking errors.
+	- If you find issues with coda, please file a bug report.
+	  Also help can be obtained via the list codal...@coda.cs.cmu.edu.
+	- Pkgsrc/net/coda has the latest source available from cmu and
+	  has been fixed to co-exist with openafs (openafs has been modified)
+
+To test:
+- Install pkgsrc/net/coda
+
+# rm -fr /var/lib/coda			# remove junk if there was a crash
+# /usr/pkg/sbin/venus-setup 	#  the domain name
+# /usr/pkg/sbin/venus
+# clog gu...@testserver.coda.cs.cmu.edu	# password is guest
+# echo foo  /coda/testserver.coda.cs.cmu.edu/playground/nb.test0 
 
+You should be able to access things in /coda



CVS commit: src/sys/coda

2012-08-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug  4 12:31:57 UTC 2012

Modified Files:
src/sys/coda: coda_psdev.c

Log Message:
Don't increment the mount reference count here. Otherwise we are left with
refcount of one when we unmount, and vfs_destroy does not... Who is expected
to decrement this anyway?!?!


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/coda/coda_psdev.c

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



CVS commit: src/sys/coda

2012-08-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug  4 12:47:00 UTC 2012

Modified Files:
src/sys/coda: README

Log Message:
mention current status


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/coda/README

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



CVS commit: src/sys/coda

2012-08-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Aug  2 16:06:59 UTC 2012

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

Log Message:
- move debugging functions to vcoda so modules with -DDEBUG link
- fix writing to coda files. this is probably not the right way to do
  this, but it satisfies the locking protocol:
1. Sometimes coda_open() is called with an unlocked vnode which
   does not satisfy the locking protocol. Lock it for now. We
   need to find out why this happens
2. VFS_VGET sometimes returns the container vnode unlocked. What
   is the locking protocol for VFS_VGET? We also lock it here.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/coda/coda_namecache.c
cvs rdiff -u -r1.26 -r1.27 src/sys/coda/coda_subr.c
cvs rdiff -u -r1.8 -r1.9 src/sys/coda/coda_subr.h
cvs rdiff -u -r1.73 -r1.74 src/sys/coda/coda_vfsops.c
cvs rdiff -u -r1.89 -r1.90 src/sys/coda/coda_vnops.c
cvs rdiff -u -r1.15 -r1.16 src/sys/coda/coda_vnops.h

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_namecache.c
diff -u src/sys/coda/coda_namecache.c:1.24 src/sys/coda/coda_namecache.c:1.25
--- src/sys/coda/coda_namecache.c:1.24	Sat Apr 18 10:58:02 2009
+++ src/sys/coda/coda_namecache.c	Thu Aug  2 12:06:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_namecache.c,v 1.24 2009/04/18 14:58:02 tsutsui Exp $	*/
+/*	$NetBSD: coda_namecache.c,v 1.25 2012/08/02 16:06:58 christos Exp $	*/
 
 /*
  *
@@ -77,7 +77,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_namecache.c,v 1.24 2009/04/18 14:58:02 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_namecache.c,v 1.25 2012/08/02 16:06:58 christos Exp $);
 
 #include sys/param.h
 #include sys/errno.h
@@ -88,10 +88,7 @@ __KERNEL_RCSID(0, $NetBSD: coda_namecac
 #include coda/coda.h
 #include coda/cnode.h
 #include coda/coda_namecache.h
-
-#ifdef	DEBUG
-#include coda/coda_vnops.h
-#endif
+#include coda/coda_subr.h
 
 /*
  * Declaration of the name cache data structure.
@@ -202,8 +199,8 @@ coda_nc_find(struct cnode *dcp, const ch
 			kauth_cred_getrefcnt(cncp-cred),
 			kauth_cred_geteuid(cncp-cred),
 			kauth_cred_getegid(cncp-cred));
-		print_cred(cred);
-		print_cred(cncp-cred);
+		coda_print_cred(cred);
+		coda_print_cred(cncp-cred);
 	}
 #endif
 	count++;

Index: src/sys/coda/coda_subr.c
diff -u src/sys/coda/coda_subr.c:1.26 src/sys/coda/coda_subr.c:1.27
--- src/sys/coda/coda_subr.c:1.26	Wed Apr 25 23:04:54 2012
+++ src/sys/coda/coda_subr.c	Thu Aug  2 12:06:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_subr.c,v 1.26 2012/04/26 03:04:54 christos Exp $	*/
+/*	$NetBSD: coda_subr.c,v 1.27 2012/08/02 16:06:58 christos Exp $	*/
 
 /*
  *
@@ -55,7 +55,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_subr.c,v 1.26 2012/04/26 03:04:54 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_subr.c,v 1.27 2012/08/02 16:06:58 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -63,6 +63,7 @@ __KERNEL_RCSID(0, $NetBSD: coda_subr.c,
 #include sys/proc.h
 #include sys/select.h
 #include sys/mount.h
+#include sys/kauth.h
 
 #include coda/coda.h
 #include coda/cnode.h
@@ -98,6 +99,8 @@ int coda_vfsop_print_entry = 0;
 #define IS_DIR(cnode)(cnode.opaque[2]  0x1)
 #endif
 
+struct vnode *coda_ctlvp;
+
 /*
  * Allocate a cnode.
  */
@@ -550,6 +553,24 @@ void coda_debugoff(void)
 coda_vfsop_print_entry = 0;
 }
 
+/* How to print a ucred */
+void
+coda_print_cred(kauth_cred_t cred)
+{
+
+	uint16_t ngroups;
+	int i;
+
+	myprintf((ref %d\tuid %d\n, kauth_cred_getrefcnt(cred),
+		 kauth_cred_geteuid(cred)));
+
+	ngroups = kauth_cred_ngroups(cred);
+	for (i=0; i  ngroups; i++)
+		myprintf((\tgroup %d: (%d)\n, i, kauth_cred_group(cred, i)));
+	myprintf((\n));
+
+}
+
 /*
  * Utilities used by both client and server
  * Standard levels:

Index: src/sys/coda/coda_subr.h
diff -u src/sys/coda/coda_subr.h:1.8 src/sys/coda/coda_subr.h:1.9
--- src/sys/coda/coda_subr.h:1.8	Sun Dec 11 07:19:50 2005
+++ src/sys/coda/coda_subr.h	Thu Aug  2 12:06:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_subr.h,v 1.8 2005/12/11 12:19:50 christos Exp $	*/
+/*	$NetBSD: coda_subr.h,v 1.9 2012/08/02 16:06:58 christos Exp $	*/
 
 /*
  *
@@ -43,5 +43,6 @@ void coda_debugoff(void);
 int  coda_kill(struct mount *whoIam, enum dc_status dcstat);
 void coda_save(struct cnode *cp);
 void coda_unsave(struct cnode *cp);
+void coda_print_cred(kauth_cred_t cred);
 
 

Index: src/sys/coda/coda_vfsops.c
diff -u src/sys/coda/coda_vfsops.c:1.73 src/sys/coda/coda_vfsops.c:1.74
--- src/sys/coda/coda_vfsops.c:1.73	Thu May  3 22:06:27 2012
+++ src/sys/coda/coda_vfsops.c	Thu Aug  2 12:06:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vfsops.c,v 1.73 2012/05/04 02:06:27 christos Exp $	*/
+/*	$NetBSD: coda_vfsops.c,v 1.74 2012/08/02 16:06:58 christos Exp $	*/
 
 /*
 

CVS commit: src/sys/coda

2012-08-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Aug  2 16:06:59 UTC 2012

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

Log Message:
- move debugging functions to vcoda so modules with -DDEBUG link
- fix writing to coda files. this is probably not the right way to do
  this, but it satisfies the locking protocol:
1. Sometimes coda_open() is called with an unlocked vnode which
   does not satisfy the locking protocol. Lock it for now. We
   need to find out why this happens
2. VFS_VGET sometimes returns the container vnode unlocked. What
   is the locking protocol for VFS_VGET? We also lock it here.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/coda/coda_namecache.c
cvs rdiff -u -r1.26 -r1.27 src/sys/coda/coda_subr.c
cvs rdiff -u -r1.8 -r1.9 src/sys/coda/coda_subr.h
cvs rdiff -u -r1.73 -r1.74 src/sys/coda/coda_vfsops.c
cvs rdiff -u -r1.89 -r1.90 src/sys/coda/coda_vnops.c
cvs rdiff -u -r1.15 -r1.16 src/sys/coda/coda_vnops.h

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



CVS commit: src/sys/coda

2012-07-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul 28 00:10:22 UTC 2012

Modified Files:
src/sys/coda: coda_vnops.c coda_vnops.h

Log Message:
-fno-common fallout.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/coda/coda_vnops.c
cvs rdiff -u -r1.14 -r1.15 src/sys/coda/coda_vnops.h

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_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.88 src/sys/coda/coda_vnops.c:1.89
--- src/sys/coda/coda_vnops.c:1.88	Fri May  4 17:57:22 2012
+++ src/sys/coda/coda_vnops.c	Sat Jul 28 00:10:22 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.88 2012/05/04 17:57:22 christos Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.89 2012/07/28 00:10:22 matt Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.88 2012/05/04 17:57:22 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.89 2012/07/28 00:10:22 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -140,6 +140,7 @@ const struct vnodeopv_entry_desc coda_vn
 { NULL, NULL }
 };
 
+int (**coda_vnodeop_p)(void *);
 const struct vnodeopv_desc coda_vnodeop_opv_desc =
 { coda_vnodeop_p, coda_vnodeop_entries };
 

Index: src/sys/coda/coda_vnops.h
diff -u src/sys/coda/coda_vnops.h:1.14 src/sys/coda/coda_vnops.h:1.15
--- src/sys/coda/coda_vnops.h:1.14	Sat Apr 28 20:01:09 2012
+++ src/sys/coda/coda_vnops.h	Sat Jul 28 00:10:22 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.h,v 1.14 2012/04/28 20:01:09 christos Exp $	*/
+/*	$NetBSD: coda_vnops.h,v 1.15 2012/07/28 00:10:22 matt Exp $	*/
 
 /*
  *
@@ -79,7 +79,7 @@ int coda_vop_nop(void *);
 int coda_getpages(void *);
 int coda_putpages(void *);
 
-int (**coda_vnodeop_p)(void *);
+extern int (**coda_vnodeop_p)(void *);
 int coda_rdwr(vnode_t *, struct uio *, enum uio_rw, int, kauth_cred_t,
 struct lwp *);
 int coda_grab_vnode(vnode_t *, dev_t, ino_t, vnode_t **);



CVS commit: src/sys/coda

2012-07-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul 28 00:10:22 UTC 2012

Modified Files:
src/sys/coda: coda_vnops.c coda_vnops.h

Log Message:
-fno-common fallout.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/coda/coda_vnops.c
cvs rdiff -u -r1.14 -r1.15 src/sys/coda/coda_vnops.h

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



CVS commit: src/sys/coda

2012-05-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  4 17:57:22 UTC 2012

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

Log Message:
comment out debugging printfs


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 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_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.87 src/sys/coda/coda_vnops.c:1.88
--- src/sys/coda/coda_vnops.c:1.87	Thu May  3 21:40:13 2012
+++ src/sys/coda/coda_vnops.c	Fri May  4 13:57:22 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.87 2012/05/04 01:40:13 christos Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.88 2012/05/04 17:57:22 christos Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.87 2012/05/04 01:40:13 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.88 2012/05/04 17:57:22 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -422,8 +422,10 @@ coda_rdwr(vnode_t *vp, struct uio *uiop,
 	 * it's completely written.
 	 */
 	if (cp-c_inode != 0  !(p  (p-p_acflag  ACORE))) {
+#ifdef CODA_VERBOSE
 	printf(%s: grabbing container vnode, losing reference\n,
 		__func__);
+#endif
 	/* Get locked and refed vnode. */
 	error = coda_grab_vnode(vp, cp-c_device, cp-c_inode, cfvp);
 	if (error) {
@@ -437,7 +439,9 @@ coda_rdwr(vnode_t *vp, struct uio *uiop,
 	VOP_UNLOCK(cfvp);
 	}
 	else {
+#ifdef CODA_VERBOSE
 	printf(%s: internal VOP_OPEN\n, __func__);
+#endif
 	opened_internally = 1;
 	MARK_INT_GEN(CODA_OPEN_STATS);
 	error = VOP_OPEN(vp, (rw == UIO_READ ? FREAD : FWRITE), cred);
@@ -849,25 +853,17 @@ coda_inactive(void *v)
 	panic(badness in coda_inactive);
 }
 
-if (IS_UNMOUNTING(cp)) {
-	/* XXX Do we need to VOP_CLOSE container vnodes? */
-	if (vp-v_usecount  1)
-	printf(%s: IS_UNMOUNTING %p usecount %d\n,
-		__func__, vp, vp-v_usecount);
-	if (cp-c_ovp != NULL)
-	printf(%s: %p ovp != NULL\n, __func__, vp);
-	VOP_UNLOCK(vp);
-} else {
-/* Sanity checks that perhaps should be panic. */
-	if (vp-v_usecount  1) {
-	printf(%s: %p usecount %d\n, __func__, vp, vp-v_usecount);
-	}
-	if (cp-c_ovp != NULL) {
-	printf(%s: %p ovp != NULL\n, __func__, vp);
-	}
-	VOP_UNLOCK(vp);
+#ifdef CODA_VERBOSE
+/* Sanity checks that perhaps should be panic. */
+if (vp-v_usecount  1)
+	printf(%s: %p usecount %d\n, __func__, vp, vp-v_usecount);
+if (cp-c_ovp != NULL)
+	printf(%s: %p ovp != NULL\n, __func__, vp);
+#endif
+/* XXX Do we need to VOP_CLOSE container vnodes? */
+VOP_UNLOCK(vp);
+if (!IS_UNMOUNTING(cp))
 	*ap-a_recycle = true;
-}
 
 MARK_INT_SAT(CODA_INACTIVE_STATS);
 return(0);
@@ -955,12 +951,13 @@ coda_lookup(void *v)
 		 myprintf((lookup result %d vpp %p\n,error,*vpp));)
 } else {
 	/* The name wasn't cached, so ask Venus. */
-	error = venus_lookup(vtomi(dvp), dcp-c_fid, nm, len, cred, l, VFid, vtype);
+	error = venus_lookup(vtomi(dvp), dcp-c_fid, nm, len, cred, l, VFid,
+	vtype);
 
 	if (error) {
 	MARK_INT_FAIL(CODA_LOOKUP_STATS);
-	CODADEBUG(CODA_LOOKUP, myprintf((lookup error on %s (%s)%d\n,
-	coda_f2s(dcp-c_fid), nm, error));)
+	CODADEBUG(CODA_LOOKUP, myprintf((%s: lookup error on %s (%s)%d\n,
+		__func__, coda_f2s(dcp-c_fid), nm, error));)
 	*vpp = (vnode_t *)0;
 	} else {
 	MARK_INT_SAT(CODA_LOOKUP_STATS);
@@ -1098,7 +1095,8 @@ coda_create(void *v)
 	coda_f2s(VFid), error)); )
 } else {
 	*vpp = (vnode_t *)0;
-	CODADEBUG(CODA_CREATE, myprintf((create error %d\n, error));)
+	CODADEBUG(CODA_CREATE, myprintf((%s: create error %d\n, __func__,
+	error));)
 }
 
 /*
@@ -1107,15 +1105,15 @@ coda_create(void *v)
  */
 vput(dvp);
 if (!error) {
-	if ((cnp-cn_flags  LOCKLEAF) == 0) {
+#ifdef CODA_VERBOSE
+	if ((cnp-cn_flags  LOCKLEAF) == 0)
 	/* This should not happen; flags are for lookup only. */
 	printf(%s: LOCKLEAF not set!\n, __func__);
-	}
 
-	if ((error = vn_lock(*ap-a_vpp, LK_EXCLUSIVE))) {
+	if ((error = vn_lock(*ap-a_vpp, LK_EXCLUSIVE)))
 	/* XXX Perhaps avoid this panic. */
 	panic(%s: couldn't lock child, __func__);
-	}
+#endif
 }
 
 return(error);
@@ -1234,14 +1232,18 @@ coda_link(void *v)
 
 /* If linking . to a name, error out earlier. */
 if (vp == dvp) {
-printf(coda_link vp==dvp\n);
+#ifdef CODA_VERBOSE
+printf(%s coda_link vp==dvp\n, __func__);
+#endif
 	error = EISDIR;
 	goto exit;
 }
 
 /* XXX Why does venus_link need the vnode to be locked?*/
 if ((error = vn_lock(vp, LK_EXCLUSIVE)) != 0) {
+#ifdef CODA_VERBOSE
 	printf(%s: couldn't lock vnode %p\n, __func__, vp);
+#endif
 	error = EFAULT;		/* XXX better value */
 	goto exit;
 }
@@ -1464,7 +1466,9 @@ coda_rmdir(void *v)
 
 /* Can't remove . in self. */
 if (dvp == vp) {
+#ifdef CODA_VERBOSE
 	printf(%s: 

CVS commit: src/sys/coda

2012-05-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  4 17:57:22 UTC 2012

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

Log Message:
comment out debugging printfs


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 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.



CVS commit: src/sys/coda

2012-05-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu May  3 14:26:43 UTC 2012

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

Log Message:
move the assert after the locked case.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 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_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.85 src/sys/coda/coda_vnops.c:1.86
--- src/sys/coda/coda_vnops.c:1.85	Wed May  2 12:51:01 2012
+++ src/sys/coda/coda_vnops.c	Thu May  3 10:26:42 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.85 2012/05/02 16:51:01 christos Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.86 2012/05/03 14:26:42 christos Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.85 2012/05/02 16:51:01 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.86 2012/05/03 14:26:42 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1953,8 +1953,6 @@ coda_getpages(void *v)
 	int waslocked;	   /* 1 if vnode lock was held on entry */
 	int didopen = 0;	/* 1 if we opened container file */
 
-	KASSERT(mutex_owned(vp-v_interlock));
-
 	/*
 	 * Handle a case that uvm_fault doesn't quite use yet.
 	 * See layer_vnops.c. for inspiration.
@@ -1963,6 +1961,8 @@ coda_getpages(void *v)
 		return EBUSY;
 	}
 
+	KASSERT(mutex_owned(vp-v_interlock));
+
 	/* Check for control object. */
 	if (IS_CTL_VP(vp)) {
 		printf(%s: control object %p\n, __func__, vp);



CVS commit: src/sys/coda

2012-05-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  4 01:38:57 UTC 2012

Modified Files:
src/sys/coda: cnode.h

Log Message:
remove variable names from prototypes.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/coda/cnode.h

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/cnode.h
diff -u src/sys/coda/cnode.h:1.17 src/sys/coda/cnode.h:1.18
--- src/sys/coda/cnode.h:1.17	Fri Mar 21 13:59:57 2008
+++ src/sys/coda/cnode.h	Thu May  3 21:38:56 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cnode.h,v 1.17 2008/03/21 17:59:57 plunky Exp $	*/
+/*	$NetBSD: cnode.h,v 1.18 2012/05/04 01:38:56 christos Exp $	*/
 
 /*
  *
@@ -187,20 +187,20 @@ enum dc_status {
 };
 
 /* cfs_psdev.h */
-extern int coda_call(struct coda_mntinfo *mntinfo, int inSize, int *outSize, void *buffer);
+extern int coda_call(struct coda_mntinfo *, int, int *, void *);
 extern int coda_kernel_version;
 
 /* cfs_subr.h */
-extern int  handleDownCall(int opcode, union outputArgs *out);
-extern void coda_unmounting(struct mount *whoIam);
-extern int  coda_vmflush(struct cnode *cp);
+extern int  handleDownCall(int, union outputArgs *);
+extern void coda_unmounting(struct mount *);
+extern int  coda_vmflush(struct cnode *);
 
 /* cfs_vnodeops.h */
-extern struct cnode *make_coda_node(CodaFid *fid, struct mount *vfsp, short type);
+extern struct cnode *make_coda_node(CodaFid *, struct mount *, short);
 extern int coda_vnodeopstats_init(void);
 
 /* coda_vfsops.h */
-extern struct mount *devtomp(dev_t dev);
+extern struct mount *devtomp(dev_t);
 
 /* sigh */
 #define CODA_RDWR ((u_long) 31)



CVS commit: src/sys/coda

2012-05-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  4 01:40:13 UTC 2012

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

Log Message:
fix locking in getpages when running executables.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 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_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.86 src/sys/coda/coda_vnops.c:1.87
--- src/sys/coda/coda_vnops.c:1.86	Thu May  3 10:26:42 2012
+++ src/sys/coda/coda_vnops.c	Thu May  3 21:40:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.86 2012/05/03 14:26:42 christos Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.87 2012/05/04 01:40:13 christos Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.86 2012/05/03 14:26:42 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.87 2012/05/04 01:40:13 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1898,10 +1898,10 @@ print_cred(kauth_cred_t cred)
  * table when coda_inactive calls coda_unsave.
  */
 struct cnode *
-make_coda_node(CodaFid *fid, struct mount *vfsp, short type)
+make_coda_node(CodaFid *fid, struct mount *fvsp, short type)
 {
 struct cnode *cp;
-int  err;
+int  error;
 
 if ((cp = coda_find(fid)) == NULL) {
 	vnode_t *vp;
@@ -1909,9 +1909,9 @@ make_coda_node(CodaFid *fid, struct moun
 	cp = coda_alloc();
 	cp-c_fid = *fid;
 
-	err = getnewvnode(VT_CODA, vfsp, coda_vnodeop_p, NULL, vp);
-	if (err) {
-	panic(%s: getnewvnode returned error %d, __func__, err);
+	error = getnewvnode(VT_CODA, fvsp, coda_vnodeop_p, NULL, vp);
+	if (error) {
+	panic(%s: getnewvnode returned error %d, __func__, error);
 	}
 	vp-v_data = cp;
 	vp-v_type = type;
@@ -1989,6 +1989,7 @@ coda_getpages(void *v)
 		 * leave it in the same state on exit.
 		 */
 		if (waslocked == 0) {
+			mutex_exit(vp-v_interlock);
 			cerror = vn_lock(vp, LK_EXCLUSIVE);
 			if (cerror) {
 printf(%s: can't lock vnode %p\n,
@@ -2021,6 +2022,8 @@ coda_getpages(void *v)
 #endif
 		cvp = cp-c_ovp;
 		didopen = 1;
+		if (waslocked == 0)
+			mutex_enter(vp-v_interlock);
 	}
 	KASSERT(cvp != NULL);
 



CVS commit: src/sys/coda

2012-05-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  4 02:06:27 UTC 2012

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

Log Message:
depend on vcoda since it has symbols we need.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/coda/coda_vfsops.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_vfsops.c
diff -u src/sys/coda/coda_vfsops.c:1.72 src/sys/coda/coda_vfsops.c:1.73
--- src/sys/coda/coda_vfsops.c:1.72	Thu Apr 26 13:18:33 2012
+++ src/sys/coda/coda_vfsops.c	Thu May  3 22:06:27 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vfsops.c,v 1.72 2012/04/26 17:18:33 christos Exp $	*/
+/*	$NetBSD: coda_vfsops.c,v 1.73 2012/05/04 02:06:27 christos Exp $	*/
 
 /*
  *
@@ -45,7 +45,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_vfsops.c,v 1.72 2012/04/26 17:18:33 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_vfsops.c,v 1.73 2012/05/04 02:06:27 christos Exp $);
 
 #ifndef _KERNEL_OPT
 #define	NVCODA 4
@@ -76,7 +76,7 @@ __KERNEL_RCSID(0, $NetBSD: coda_vfsops.
 #include miscfs/specfs/specdev.h
 #include miscfs/genfs/genfs.h
  
-MODULE(MODULE_CLASS_VFS, coda, NULL);
+MODULE(MODULE_CLASS_VFS, coda, vcoda);
 
 #define ENTRY if(coda_vfsop_print_entry) myprintf((Entered %s\n,__func__))
 



CVS commit: src/sys/coda

2012-05-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu May  3 14:26:43 UTC 2012

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

Log Message:
move the assert after the locked case.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 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.



CVS commit: src/sys/coda

2012-05-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  4 01:38:57 UTC 2012

Modified Files:
src/sys/coda: cnode.h

Log Message:
remove variable names from prototypes.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/coda/cnode.h

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



CVS commit: src/sys/coda

2012-05-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  4 01:40:13 UTC 2012

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

Log Message:
fix locking in getpages when running executables.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 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.



CVS commit: src/sys/coda

2012-05-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  4 02:06:27 UTC 2012

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

Log Message:
depend on vcoda since it has symbols we need.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/coda/coda_vfsops.c

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



CVS commit: src/sys/coda

2012-05-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May  2 16:51:02 UTC 2012

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

Log Message:
Instead of sharing the coda vnode lock with the ffs vnode lock, share the
ffs vnode lock with coda.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 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_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.84 src/sys/coda/coda_vnops.c:1.85
--- src/sys/coda/coda_vnops.c:1.84	Sat Apr 28 16:15:07 2012
+++ src/sys/coda/coda_vnops.c	Wed May  2 12:51:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.84 2012/04/28 20:15:07 christos Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.85 2012/05/02 16:51:01 christos Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.84 2012/04/28 20:15:07 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.85 2012/05/02 16:51:01 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1808,10 +1808,9 @@ coda_grab_vnode(vnode_t *uvp, dev_t dev,
 	(unsigned long long)dev, (unsigned long long)ino, *vpp, error));
 	return(ENOENT);
 }
-/* share the lock with the underlying vnode */
-mutex_obj_hold(uvp-v_interlock);
-uvm_obj_setlock((*vpp)-v_uobj, uvp-v_interlock);
-
+/* share the underlying vnode lock with the coda vnode */
+mutex_obj_hold((*vpp)-v_interlock);
+uvm_obj_setlock(uvp-v_uobj, (*vpp)-v_interlock);
 return(0);
 }
 



CVS commit: src/sys/coda

2012-05-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May  2 16:51:02 UTC 2012

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

Log Message:
Instead of sharing the coda vnode lock with the ffs vnode lock, share the
ffs vnode lock with coda.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 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.



CVS commit: src/sys/coda

2012-04-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 28 20:01:09 UTC 2012

Modified Files:
src/sys/coda: coda_vnops.c coda_vnops.h

Log Message:
Fixes from get/putpages from rmind.
In grab vnode, share the lock of the coda vnode with the underlying vnode,
so that the locking protocol works.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/coda/coda_vnops.c
cvs rdiff -u -r1.13 -r1.14 src/sys/coda/coda_vnops.h

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_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.82 src/sys/coda/coda_vnops.c:1.83
--- src/sys/coda/coda_vnops.c:1.82	Wed Apr 25 23:04:54 2012
+++ src/sys/coda/coda_vnops.c	Sat Apr 28 16:01:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.82 2012/04/26 03:04:54 christos Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.83 2012/04/28 20:01:09 christos Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.82 2012/04/26 03:04:54 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.83 2012/04/28 20:01:09 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -250,7 +250,7 @@ coda_open(void *v)
  * Obtain locked and referenced container vnode from container
  * device/inode.
  */
-error = coda_grab_vnode(dev, inode, container_vp);
+error = coda_grab_vnode(vp, dev, inode, container_vp);
 if (error)
 	return (error);
 
@@ -425,7 +425,7 @@ coda_rdwr(struct vnode *vp, struct uio *
 	if (cp-c_inode != 0  !(p  (p-p_acflag  ACORE))) {
 	printf(coda_rdwr: grabbing container vnode, losing reference\n);
 	/* Get locked and refed vnode. */
-	error = coda_grab_vnode(cp-c_device, cp-c_inode, cfvp);
+	error = coda_grab_vnode(vp, cp-c_device, cp-c_inode, cfvp);
 	if (error) {
 		MARK_INT_FAIL(CODA_RDWR_STATS);
 		return(error);
@@ -1791,7 +1791,7 @@ coda_islocked(void *v)
  * obtained and passed back to the caller.
  */
 int
-coda_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp)
+coda_grab_vnode(struct vnode *uvp, dev_t dev, ino_t ino, struct vnode **vpp)
 {
 int   error;
 struct mount *mp;
@@ -1814,6 +1814,10 @@ coda_grab_vnode(dev_t dev, ino_t ino, st
 	(unsigned long long)dev, (unsigned long long)ino, *vpp, error));
 	return(ENOENT);
 }
+/* share the lock with the underlying vnode */
+mutex_obj_hold(uvp-v_interlock);
+uvm_obj_setlock((*vpp)-v_uobj, uvp-v_interlock);
+
 return(0);
 }
 
@@ -1934,8 +1938,6 @@ make_coda_node(CodaFid *fid, struct moun
  * e.g. to fault in pages to execute a program.  In that case, we must
  * open the file to get the container.  The vnode may or may not be
  * locked, and we must leave it in the same state.
- * XXX The protocol requires v_uobj.vmobjlock to be
- * held by caller, but this isn't documented in vnodeops(9) or vnode_if.src.
  */
 int
 coda_getpages(void *v)
@@ -1950,7 +1952,7 @@ coda_getpages(void *v)
 		int a_advice;
 		int a_flags;
 	} */ *ap = v;
-	struct vnode *vp = ap-a_vp;
+	struct vnode *vp = ap-a_vp, *cvp;
 	struct cnode *cp = VTOC(vp);
 	struct lwp *l = curlwp;
 	kauth_cred_t cred = l-l_cred;
@@ -1958,6 +1960,8 @@ coda_getpages(void *v)
 	int waslocked;	   /* 1 if vnode lock was held on entry */
 	int didopen = 0;	/* 1 if we opened container file */
 
+	KASSERT(mutex_owned(vp-v_interlock));
+
 	/*
 	 * Handle a case that uvm_fault doesn't quite use yet.
 	 * See layer_vnops.c. for inspiration.
@@ -1969,7 +1973,6 @@ coda_getpages(void *v)
 	/* Check for control object. */
 	if (IS_CTL_VP(vp)) {
 		printf(coda_getpages: control object %p\n, vp);
-		mutex_exit(vp-v_uobj.vmobjlock);
 		return(EINVAL);
 	}
 
@@ -1984,11 +1987,9 @@ coda_getpages(void *v)
 	/* XXX VOP_ISLOCKED() may not be used for lock decisions. */
 	waslocked = VOP_ISLOCKED(vp);
 
-	/* Drop the vmobject lock. */
-	mutex_exit(vp-v_uobj.vmobjlock);
-
 	/* Get container file if not already present. */
-	if (cp-c_ovp == NULL) {
+	cvp = cp-c_ovp;
+	if (cvp == NULL) {
 		/*
 		 * VOP_OPEN requires a locked vnode.  We must avoid
 		 * locking the vnode if it is already locked, and
@@ -2025,15 +2026,16 @@ coda_getpages(void *v)
 #if 0
 		printf(coda_getpages: opened vnode %p\n, vp);
 #endif
+		cvp = cp-c_ovp;
 		didopen = 1;
 	}
-	KASSERT(cp-c_ovp != NULL);
+	KASSERT(cvp != NULL);
 
 	/* Munge the arg structure to refer to the container vnode. */
+	KASSERT(cvp-v_interlock == vp-v_interlock);
 	ap-a_vp = cp-c_ovp;
 
-	/* Get the lock on the container vnode, and call getpages on it. */
-	mutex_enter(ap-a_vp-v_uobj.vmobjlock);
+	/* Finally, call getpages on it. */
 	error = VCALL(ap-a_vp, VOFFSET(vop_getpages), ap);
 
 	/* If we opened the vnode, we must close it. */
@@ -2057,8 +2059,7 @@ coda_getpages(void *v)
 }
 
 /*
- * The protocol requires v_uobj.vmobjlock to be held by the caller, as
- * documented in vnodeops(9).  XXX vnode_if.src doesn't say this.
+ * The 

CVS commit: src/sys/coda

2012-04-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 28 20:15:07 UTC 2012

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

Log Message:
cosmetic only: __func__, vnode_t


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 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_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.83 src/sys/coda/coda_vnops.c:1.84
--- src/sys/coda/coda_vnops.c:1.83	Sat Apr 28 16:01:09 2012
+++ src/sys/coda/coda_vnops.c	Sat Apr 28 16:15:07 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.83 2012/04/28 20:01:09 christos Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.84 2012/04/28 20:15:07 christos Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.83 2012/04/28 20:01:09 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.84 2012/04/28 20:15:07 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -153,8 +153,8 @@ coda_vop_error(void *anon) {
 struct vnodeop_desc **desc = (struct vnodeop_desc **)anon;
 
 if (codadebug) {
-	myprintf((coda_vop_error: Vnode operation %s called (error).\n,
-		  (*desc)-vdesc_name));
+	myprintf((%s: Vnode operation %s called (error).\n,
+	__func__, (*desc)-vdesc_name));
 }
 
 return EIO;
@@ -214,7 +214,7 @@ coda_open(void *v)
  */
 /* true args */
 struct vop_open_args *ap = v;
-struct vnode *vp = ap-a_vp;
+vnode_t *vp = ap-a_vp;
 struct cnode *cp = VTOC(vp);
 int flag = ap-a_mode  (~O_EXCL);
 kauth_cred_t cred = ap-a_cred;
@@ -222,7 +222,7 @@ coda_open(void *v)
 int error;
 dev_t dev;			/* container file device, inode, vnode */
 ino_t inode;
-struct vnode *container_vp;
+vnode_t *container_vp;
 
 MARK_ENTRY(CODA_OPEN_STATS);
 
@@ -241,9 +241,9 @@ coda_open(void *v)
 if (error)
 	return (error);
 if (!error) {
-	CODADEBUG(CODA_OPEN,
-		myprintf((open: dev 0x%llx inode %llu result %d\n,
-	(unsigned long long)dev, (unsigned long long)inode, error));)
+	CODADEBUG(CODA_OPEN, myprintf((
+		%s: dev 0x%llx inode %llu result %d\n, __func__,
+		(unsigned long long)dev, (unsigned long long)inode, error));)
 }
 
 /* 
@@ -263,7 +263,7 @@ coda_open(void *v)
 	 * Perhaps venus returned a different container, or
 	 * something else went wrong.
 	 */
-	panic(coda_open: cp-c_ovp != container_vp);
+	panic(%s: cp-c_ovp != container_vp, __func__);
 }
 cp-c_ocount++;
 
@@ -300,7 +300,7 @@ coda_close(void *v)
 {
 /* true args */
 struct vop_close_args *ap = v;
-struct vnode *vp = ap-a_vp;
+vnode_t *vp = ap-a_vp;
 struct cnode *cp = VTOC(vp);
 int flag = ap-a_fflag;
 kauth_cred_t cred = ap-a_cred;
@@ -321,8 +321,8 @@ coda_close(void *v)
 if (IS_UNMOUNTING(cp)) {
 	if (cp-c_ovp) {
 #ifdef	CODA_VERBOSE
-	printf(coda_close: destroying container ref %d, ufs vp %p of vp %p/cp %p\n,
-		vp-v_usecount, cp-c_ovp, vp, cp);
+	printf(%s: destroying container %d, ufs vp %p of vp %p/cp %p\n,
+		__func__, vp-v_usecount, cp-c_ovp, vp, cp);
 #endif
 #ifdef	hmm
 	vgone(cp-c_ovp);
@@ -333,7 +333,7 @@ coda_close(void *v)
 #endif
 	} else {
 #ifdef	CODA_VERBOSE
-	printf(coda_close: NO container vp %p/cp %p\n, vp, cp);
+	printf(%s: NO container vp %p/cp %p\n, __func__, vp, cp);
 #endif
 	}
 	return ENODEV;
@@ -355,7 +355,7 @@ coda_close(void *v)
 
 error = venus_close(vtomi(vp), cp-c_fid, flag, cred, curlwp);
 
-CODADEBUG(CODA_CLOSE, myprintf((close: result %d\n,error)); )
+CODADEBUG(CODA_CLOSE, myprintf((%s: result %d\n, __func__, error)); )
 return(error);
 }
 
@@ -380,14 +380,14 @@ coda_write(void *v)
 }
 
 int
-coda_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw, int ioflag,
+coda_rdwr(vnode_t *vp, struct uio *uiop, enum uio_rw rw, int ioflag,
 	kauth_cred_t cred, struct lwp *l)
 {
 /* upcall decl */
   /* NOTE: container file operation!!! */
 /* locals */
 struct cnode *cp = VTOC(vp);
-struct vnode *cfvp = cp-c_ovp;
+vnode_t *cfvp = cp-c_ovp;
 struct proc *p = l-l_proc;
 int opened_internally = 0;
 int error = 0;
@@ -395,9 +395,8 @@ coda_rdwr(struct vnode *vp, struct uio *
 MARK_ENTRY(CODA_RDWR_STATS);
 
 CODADEBUG(CODA_RDWR, myprintf((coda_rdwr(%d, %p, %lu, %lld)\n, rw,
-			  uiop-uio_iov-iov_base,
-			  (unsigned long) uiop-uio_resid,
-			  (long long) uiop-uio_offset)); )
+	uiop-uio_iov-iov_base, (unsigned long) uiop-uio_resid,
+	(long long) uiop-uio_offset)); )
 
 /* Check for rdwr of control object. */
 if (IS_CTL_VP(vp)) {
@@ -423,7 +422,8 @@ coda_rdwr(struct vnode *vp, struct uio *
 	 * it's completely written.
 	 */
 	if (cp-c_inode != 0  !(p  (p-p_acflag  ACORE))) {
-	printf(coda_rdwr: grabbing container vnode, losing reference\n);
+	printf(%s: grabbing container vnode, losing reference\n,
+		

CVS commit: src/sys/coda

2012-04-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 28 20:01:09 UTC 2012

Modified Files:
src/sys/coda: coda_vnops.c coda_vnops.h

Log Message:
Fixes from get/putpages from rmind.
In grab vnode, share the lock of the coda vnode with the underlying vnode,
so that the locking protocol works.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/coda/coda_vnops.c
cvs rdiff -u -r1.13 -r1.14 src/sys/coda/coda_vnops.h

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



CVS commit: src/sys/coda

2012-04-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 28 20:15:07 UTC 2012

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

Log Message:
cosmetic only: __func__, vnode_t


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 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.



CVS commit: src/sys/coda

2012-04-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 26 17:18:33 UTC 2012

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

Log Message:
remove multiple definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/coda/coda_vfsops.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_vfsops.c
diff -u src/sys/coda/coda_vfsops.c:1.71 src/sys/coda/coda_vfsops.c:1.72
--- src/sys/coda/coda_vfsops.c:1.71	Wed Apr 25 23:04:54 2012
+++ src/sys/coda/coda_vfsops.c	Thu Apr 26 13:18:33 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vfsops.c,v 1.71 2012/04/26 03:04:54 christos Exp $	*/
+/*	$NetBSD: coda_vfsops.c,v 1.72 2012/04/26 17:18:33 christos Exp $	*/
 
 /*
  *
@@ -45,7 +45,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_vfsops.c,v 1.71 2012/04/26 03:04:54 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_vfsops.c,v 1.72 2012/04/26 17:18:33 christos Exp $);
 
 #ifndef _KERNEL_OPT
 #define	NVCODA 4
@@ -78,11 +78,6 @@ __KERNEL_RCSID(0, $NetBSD: coda_vfsops.
  
 MODULE(MODULE_CLASS_VFS, coda, NULL);
 
-MALLOC_DEFINE(M_CODA, coda, Coda file system structures and tables);
-
-int codadebug = 0;
-
-int coda_vfsop_print_entry = 0;
 #define ENTRY if(coda_vfsop_print_entry) myprintf((Entered %s\n,__func__))
 
 struct vnode *coda_ctlvp;



CVS commit: src/sys/coda

2012-04-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 26 17:18:33 UTC 2012

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

Log Message:
remove multiple definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/coda/coda_vfsops.c

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



CVS commit: src/sys/coda

2012-04-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 26 03:04:55 UTC 2012

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

Log Message:
re-arrange things so that vcoda does not depend on coda.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/coda/coda_psdev.c
cvs rdiff -u -r1.25 -r1.26 src/sys/coda/coda_subr.c
cvs rdiff -u -r1.28 -r1.29 src/sys/coda/coda_venus.c
cvs rdiff -u -r1.70 -r1.71 src/sys/coda/coda_vfsops.c
cvs rdiff -u -r1.81 -r1.82 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_psdev.c
diff -u src/sys/coda/coda_psdev.c:1.47 src/sys/coda/coda_psdev.c:1.48
--- src/sys/coda/coda_psdev.c:1.47	Sat Jan 10 21:45:46 2009
+++ src/sys/coda/coda_psdev.c	Wed Apr 25 23:04:54 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_psdev.c,v 1.47 2009/01/11 02:45:46 christos Exp $	*/
+/*	$NetBSD: coda_psdev.c,v 1.48 2012/04/26 03:04:54 christos Exp $	*/
 
 /*
  *
@@ -54,7 +54,7 @@
 /* These routines are the device entry points for Venus. */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_psdev.c,v 1.47 2009/01/11 02:45:46 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_psdev.c,v 1.48 2012/04/26 03:04:54 christos Exp $);
 
 extern int coda_nc_initialized;/* Set if cache has been initialized */
 
@@ -76,6 +76,7 @@ extern int coda_nc_initialized;/* Se
 #include sys/select.h
 #include sys/conf.h
 #include sys/atomic.h
+#include sys/module.h
 
 #include miscfs/syncfs/syncfs.h
 
@@ -95,6 +96,8 @@ int coda_pcatch = PCATCH;
 #else
 #endif
 
+int coda_kernel_version = CODA_KERNEL_VERSION;
+
 #define ENTRY if(coda_psdev_print_entry) myprintf((Entered %s\n,__func__))
 
 void vcodaattach(int n);
@@ -123,6 +126,8 @@ struct vmsg {
 void *	 vm_sleep;	/* Not used by Mach. */
 };
 
+struct coda_mntinfo coda_mnttbl[NVCODA];
+
 #define	VM_READ	1
 #define	VM_WRITE2
 #define	VM_INTR	4
@@ -721,3 +726,43 @@ coda_call(struct coda_mntinfo *mntinfo, 
 	return(error);
 }
 
+MODULE(MODULE_CLASS_DRIVER, vcoda, NULL);
+
+static int
+vcoda_modcmd(modcmd_t cmd, void *arg)
+{
+	int cmajor, dmajor, error = 0;
+
+	dmajor = cmajor = -1;
+
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+#ifdef _MODULE
+		vcodaattach(NVCODA);
+
+		return devsw_attach(vcoda, NULL, dmajor,
+		vcoda_cdevsw, cmajor);
+#endif
+		break;
+
+	case MODULE_CMD_FINI:
+#ifdef _MODULE
+		{
+			for  (size_t i = 0; i  NVCODA; i++) {
+struct vcomm *vcp = coda_mnttbl[i].mi_vcomm;
+if (VC_OPEN(vcp))
+	return EBUSY;
+			}
+			return devsw_detach(NULL, vcoda_cdevsw);
+		}
+#endif
+		break;
+
+	case MODULE_CMD_STAT:
+		return ENOTTY;
+
+	default:
+		return ENOTTY;
+	}
+	return error;
+}

Index: src/sys/coda/coda_subr.c
diff -u src/sys/coda/coda_subr.c:1.25 src/sys/coda/coda_subr.c:1.26
--- src/sys/coda/coda_subr.c:1.25	Wed Aug 31 14:31:02 2011
+++ src/sys/coda/coda_subr.c	Wed Apr 25 23:04:54 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_subr.c,v 1.25 2011/08/31 18:31:02 plunky Exp $	*/
+/*	$NetBSD: coda_subr.c,v 1.26 2012/04/26 03:04:54 christos Exp $	*/
 
 /*
  *
@@ -55,7 +55,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_subr.c,v 1.25 2011/08/31 18:31:02 plunky Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_subr.c,v 1.26 2012/04/26 03:04:54 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -79,6 +79,12 @@ int coda_new = 0;
 
 struct cnode *coda_freelist = NULL;
 struct cnode *coda_cache[CODA_CACHESIZE];
+MALLOC_DEFINE(M_CODA, coda, Coda file system structures and tables);
+
+int codadebug = 0;
+int coda_printf_delay = 0;  /* in microseconds */
+int coda_vnop_print_entry = 0;
+int coda_vfsop_print_entry = 0;
 
 #define	CNODE_NEXT(cp)	((cp)-c_next)
 

Index: src/sys/coda/coda_venus.c
diff -u src/sys/coda/coda_venus.c:1.28 src/sys/coda/coda_venus.c:1.29
--- src/sys/coda/coda_venus.c:1.28	Tue Jul 20 13:26:03 2010
+++ src/sys/coda/coda_venus.c	Wed Apr 25 23:04:54 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_venus.c,v 1.28 2010/07/20 17:26:03 christos Exp $	*/
+/*	$NetBSD: coda_venus.c,v 1.29 2012/04/26 03:04:54 christos Exp $	*/
 
 /*
  *
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_venus.c,v 1.28 2010/07/20 17:26:03 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_venus.c,v 1.29 2012/04/26 03:04:54 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -201,8 +201,6 @@ __KERNEL_RCSID(0, $NetBSD: coda_venus.c
 	} while (/*CONSTCOND*/ 0)
 
 
-int coda_kernel_version = CODA_KERNEL_VERSION;
-
 int
 venus_root(void *mdp,
 	kauth_cred_t cred, struct proc *p,

Index: src/sys/coda/coda_vfsops.c
diff -u src/sys/coda/coda_vfsops.c:1.70 src/sys/coda/coda_vfsops.c:1.71
--- src/sys/coda/coda_vfsops.c:1.70	Mon Sep 26 20:54:47 2011
+++ src/sys/coda/coda_vfsops.c	Wed Apr 25 23:04:54 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vfsops.c,v 1.70 2011/09/27 00:54:47 christos Exp $	*/

CVS commit: src/sys/coda

2012-04-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 26 03:04:55 UTC 2012

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

Log Message:
re-arrange things so that vcoda does not depend on coda.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/coda/coda_psdev.c
cvs rdiff -u -r1.25 -r1.26 src/sys/coda/coda_subr.c
cvs rdiff -u -r1.28 -r1.29 src/sys/coda/coda_venus.c
cvs rdiff -u -r1.70 -r1.71 src/sys/coda/coda_vfsops.c
cvs rdiff -u -r1.81 -r1.82 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.



CVS commit: src/sys/coda

2011-09-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Sep 27 00:54:47 UTC 2011

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

Log Message:
use CODA_MAXNAMLEN instead of bogus MAXNAMLEN


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/coda/coda_vfsops.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_vfsops.c
diff -u src/sys/coda/coda_vfsops.c:1.69 src/sys/coda/coda_vfsops.c:1.70
--- src/sys/coda/coda_vfsops.c:1.69	Mon Jun 29 01:08:15 2009
+++ src/sys/coda/coda_vfsops.c	Mon Sep 26 20:54:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vfsops.c,v 1.69 2009/06/29 05:08:15 dholland Exp $	*/
+/*	$NetBSD: coda_vfsops.c,v 1.70 2011/09/27 00:54:47 christos Exp $	*/
 
 /*
  *
@@ -45,7 +45,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_vfsops.c,v 1.69 2009/06/29 05:08:15 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_vfsops.c,v 1.70 2011/09/27 00:54:47 christos Exp $);
 
 #ifndef _KERNEL_OPT
 #define	NVCODA 4
@@ -257,7 +257,7 @@ coda_mount(struct mount *vfsp,	/* Alloca
 vfsp-mnt_stat.f_fsidx.__fsid_val[0] = 0;
 vfsp-mnt_stat.f_fsidx.__fsid_val[1] = makefstype(MOUNT_CODA);
 vfsp-mnt_stat.f_fsid = vfsp-mnt_stat.f_fsidx.__fsid_val[0];
-vfsp-mnt_stat.f_namemax = MAXNAMLEN;
+vfsp-mnt_stat.f_namemax = CODA_MAXNAMLEN;
 mi-mi_vfsp = vfsp;
 
 /*



CVS commit: src/sys/coda

2011-09-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Sep 27 00:54:47 UTC 2011

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

Log Message:
use CODA_MAXNAMLEN instead of bogus MAXNAMLEN


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/coda/coda_vfsops.c

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



CVS commit: src/sys/coda

2011-09-13 Thread Greg Troxel
Module Name:src
Committed By:   gdt
Date:   Tue Sep 13 19:34:27 UTC 2011

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

Log Message:
Reduce verbosity of semi-debug coda_inactive printf.

Rather than print if the usecount is  0, only print if it is greater
than 1.  It seems 1 is normal.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 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_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.80 src/sys/coda/coda_vnops.c:1.81
--- src/sys/coda/coda_vnops.c:1.80	Sun Jun 12 03:35:51 2011
+++ src/sys/coda/coda_vnops.c	Tue Sep 13 19:34:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.80 2011/06/12 03:35:51 rmind Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.81 2011/09/13 19:34:27 gdt Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.80 2011/06/12 03:35:51 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.81 2011/09/13 19:34:27 gdt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -854,7 +854,7 @@
 
 if (IS_UNMOUNTING(cp)) {
 	/* XXX Do we need to VOP_CLOSE container vnodes? */
-	if (vp-v_usecount  0)
+	if (vp-v_usecount  1)
 	printf(coda_inactive: IS_UNMOUNTING %p usecount %d\n,
 		   vp, vp-v_usecount);
 	if (cp-c_ovp != NULL)
@@ -862,7 +862,7 @@
 	VOP_UNLOCK(vp);
 } else {
 /* Sanity checks that perhaps should be panic. */
-	if (vp-v_usecount) {
+	if (vp-v_usecount  1) {
 	printf(coda_inactive: %p usecount %d\n, vp, vp-v_usecount);
 	}
 	if (cp-c_ovp != NULL) {



CVS commit: src/sys/coda

2011-09-13 Thread Greg Troxel
Module Name:src
Committed By:   gdt
Date:   Tue Sep 13 19:34:27 UTC 2011

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

Log Message:
Reduce verbosity of semi-debug coda_inactive printf.

Rather than print if the usecount is  0, only print if it is greater
than 1.  It seems 1 is normal.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 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.



CVS commit: src/sys/coda

2010-08-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug  7 20:39:33 UTC 2010

Modified Files:
src/sys/coda: coda.h coda_pioctl.h

Log Message:
Fix incorrect comments about the buffer size being 2K; it is really 8K now.
From Robert Watson.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/coda/coda.h
cvs rdiff -u -r1.7 -r1.8 src/sys/coda/coda_pioctl.h

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.h
diff -u src/sys/coda/coda.h:1.16 src/sys/coda/coda.h:1.17
--- src/sys/coda/coda.h:1.16	Tue Jul 20 13:26:03 2010
+++ src/sys/coda/coda.h	Sat Aug  7 16:39:33 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: coda.h,v 1.16 2010/07/20 17:26:03 christos Exp $ */
+/* $NetBSD: coda.h,v 1.17 2010/08/07 20:39:33 christos Exp $ */
 
 /*
 
@@ -793,8 +793,8 @@
 #define PIOCPARM_MASK 0x
 struct ViceIoctl {
 void *in, *out;		/* Data to be transferred in, or out */
-unsigned short in_size; /* Size of input buffer = 2K */
-unsigned short out_size;/* Maximum size of output buffer, = 2K */
+unsigned short in_size; /* Size of input buffer = 8K */
+unsigned short out_size;/* Maximum size of output buffer, = 8K */
 };
 
 struct PioctlData {

Index: src/sys/coda/coda_pioctl.h
diff -u src/sys/coda/coda_pioctl.h:1.7 src/sys/coda/coda_pioctl.h:1.8
--- src/sys/coda/coda_pioctl.h:1.7	Sun Dec 11 07:19:50 2005
+++ src/sys/coda/coda_pioctl.h	Sat Aug  7 16:39:33 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_pioctl.h,v 1.7 2005/12/11 12:19:50 christos Exp $	*/
+/*	$NetBSD: coda_pioctl.h,v 1.8 2010/08/07 20:39:33 christos Exp $	*/
 
 /*
  *
@@ -51,7 +51,7 @@
 #ifndef	_SYS_PIOCTL_H_
 #define _SYS_PIOCTL_H_
 
-/* The 2K limits above are a consequence of the size of the kernel buffer
+/* The 8K limits above are a consequence of the size of the kernel buffer
used to buffer requests from the user to venus--2*MAXPATHLEN.
The buffer pointers may be null, or the counts may be 0 if there
are no input or output parameters



CVS commit: src/sys/coda

2010-08-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug  7 20:39:33 UTC 2010

Modified Files:
src/sys/coda: coda.h coda_pioctl.h

Log Message:
Fix incorrect comments about the buffer size being 2K; it is really 8K now.
From Robert Watson.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/coda/coda.h
cvs rdiff -u -r1.7 -r1.8 src/sys/coda/coda_pioctl.h

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



CVS commit: src/sys/coda

2010-07-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jul 20 17:26:04 UTC 2010

Modified Files:
src/sys/coda: coda.h coda_venus.c coda_vnops.c

Log Message:
Correct incomplete size checks for the coda ioctls. From Dan Rosenberg.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/coda/coda.h
cvs rdiff -u -r1.27 -r1.28 src/sys/coda/coda_venus.c
cvs rdiff -u -r1.75 -r1.76 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.h
diff -u src/sys/coda/coda.h:1.15 src/sys/coda/coda.h:1.16
--- src/sys/coda/coda.h:1.15	Mon Sep 28 06:51:35 2009
+++ src/sys/coda/coda.h	Tue Jul 20 13:26:03 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: coda.h,v 1.15 2009/09/28 10:51:35 blymn Exp $ */
+/* $NetBSD: coda.h,v 1.16 2010/07/20 17:26:03 christos Exp $ */
 
 /*
 
@@ -793,8 +793,8 @@
 #define PIOCPARM_MASK 0x
 struct ViceIoctl {
 void *in, *out;		/* Data to be transferred in, or out */
-short in_size;  /* Size of input buffer = 2K */
-short out_size; /* Maximum size of output buffer, = 2K */
+unsigned short in_size; /* Size of input buffer = 2K */
+unsigned short out_size;/* Maximum size of output buffer, = 2K */
 };
 
 struct PioctlData {

Index: src/sys/coda/coda_venus.c
diff -u src/sys/coda/coda_venus.c:1.27 src/sys/coda/coda_venus.c:1.28
--- src/sys/coda/coda_venus.c:1.27	Sat Apr 18 10:58:02 2009
+++ src/sys/coda/coda_venus.c	Tue Jul 20 13:26:03 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_venus.c,v 1.27 2009/04/18 14:58:02 tsutsui Exp $	*/
+/*	$NetBSD: coda_venus.c,v 1.28 2010/07/20 17:26:03 christos Exp $	*/
 
 /*
  *
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_venus.c,v 1.27 2009/04/18 14:58:02 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_venus.c,v 1.28 2010/07/20 17:26:03 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -308,7 +308,7 @@
 tmp = ((com  16)  IOCPARM_MASK) - sizeof (char *) - sizeof (int);
 inp-cmd |= (tmp  IOCPARM_MASK) 	16;
 
-if (iap-vi.in_size  0 || iap-vi.in_size  VC_MAXMSGSIZE) {
+if (iap-vi.in_size  VC_MAXMSGSIZE || iap-vi.out_size  VC_MAXMSGSIZE) {
 	CODA_FREE(inp, coda_ioctl_size);
 	return (EINVAL);
 }

Index: src/sys/coda/coda_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.75 src/sys/coda/coda_vnops.c:1.76
--- src/sys/coda/coda_vnops.c:1.75	Thu Jul  1 09:00:54 2010
+++ src/sys/coda/coda_vnops.c	Tue Jul 20 13:26:03 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.75 2010/07/01 13:00:54 hannken Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.76 2010/07/20 17:26:03 christos Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.75 2010/07/01 13:00:54 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.76 2010/07/20 17:26:03 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -539,7 +539,7 @@
 	return(EINVAL);
 }
 
-if (iap-vi.in_size  VC_MAXDATASIZE) {
+if (iap-vi.in_size  VC_MAXDATASIZE || iap-vi.out_size  VC_MAXDATASIZE) {
 	vrele(tvp);
 	return(EINVAL);
 }



CVS commit: src/sys/coda

2010-07-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jul 20 17:26:04 UTC 2010

Modified Files:
src/sys/coda: coda.h coda_venus.c coda_vnops.c

Log Message:
Correct incomplete size checks for the coda ioctls. From Dan Rosenberg.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/coda/coda.h
cvs rdiff -u -r1.27 -r1.28 src/sys/coda/coda_venus.c
cvs rdiff -u -r1.75 -r1.76 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.



CVS commit: src/sys/coda

2010-06-24 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Thu Jun 24 10:37:22 UTC 2010

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

Log Message:
coda_lock(): LK_INTERLOCK flag no longer possible.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 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_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.72 src/sys/coda/coda_vnops.c:1.73
--- src/sys/coda/coda_vnops.c:1.72	Thu Jun 24 07:54:46 2010
+++ src/sys/coda/coda_vnops.c	Thu Jun 24 10:37:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.72 2010/06/24 07:54:46 hannken Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.73 2010/06/24 10:37:22 hannken Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.72 2010/06/24 07:54:46 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: coda_vnops.c,v 1.73 2010/06/24 10:37:22 hannken Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1786,11 +1786,6 @@
 		  coda_f2s(cp-c_fid)));
 }
 
-if ((flags  LK_INTERLOCK) != 0) {
-	mutex_exit(vp-v_interlock);
-	flags = ~LK_INTERLOCK;
-}
-
 return (vlockmgr(vp-v_lock, flags));
 }
 



CVS commit: src/sys/coda

2010-06-24 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Thu Jun 24 10:37:22 UTC 2010

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

Log Message:
coda_lock(): LK_INTERLOCK flag no longer possible.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 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.



CVS commit: src/sys/coda

2009-09-28 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Mon Sep 28 10:51:35 UTC 2009

Modified Files:
src/sys/coda: coda.h

Log Message:
Make file_id unsigned so it does not get sign extended when promoted
to a 64bit ino_t.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/coda/coda.h

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.h
diff -u src/sys/coda/coda.h:1.14 src/sys/coda/coda.h:1.15
--- src/sys/coda/coda.h:1.14	Sun Mar  4 06:01:11 2007
+++ src/sys/coda/coda.h	Mon Sep 28 10:51:35 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: coda.h,v 1.14 2007/03/04 06:01:11 christos Exp $ */
+/* $NetBSD: coda.h,v 1.15 2009/09/28 10:51:35 blymn Exp $ */
 
 /*
 
@@ -272,7 +272,7 @@
 	short		va_nlink;	/* number of references to file */
 	uid_t		va_uid;		/* owner user id */
 	gid_t		va_gid;		/* owner group id */
-	long		va_fileid;	/* file id */
+	u_long		va_fileid;	/* file id */
 	u_quad_t	va_size;	/* file size in bytes */
 	long		va_blocksize;	/* blocksize preferred for i/o */
 	struct timespec	va_atime;	/* time of last access */