CVS commit: src/sys/kern

2022-08-22 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Aug 22 09:13:08 UTC 2022

Modified Files:
src/sys/kern: vfs_trans.c

Log Message:
Don't allocate lwp info for fstrans_held() and fstrans_is_owner().
If it doesn't exist we cannot hold a transaction or suspension.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/kern/vfs_trans.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/kern/vfs_trans.c
diff -u src/sys/kern/vfs_trans.c:1.67 src/sys/kern/vfs_trans.c:1.68
--- src/sys/kern/vfs_trans.c:1.67	Thu Aug 11 10:17:44 2022
+++ src/sys/kern/vfs_trans.c	Mon Aug 22 09:13:08 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_trans.c,v 1.67 2022/08/11 10:17:44 hannken Exp $	*/
+/*	$NetBSD: vfs_trans.c,v 1.68 2022/08/22 09:13:08 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.67 2022/08/11 10:17:44 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.68 2022/08/22 09:13:08 hannken Exp $");
 
 /*
  * File system transaction operations.
@@ -631,7 +631,7 @@ fstrans_held(struct mount *mp)
 
 	KASSERT(mp != dead_rootmount);
 
-	fli = fstrans_get_lwp_info(mp, true);
+	fli = fstrans_get_lwp_info(mp, false);
 	if (fli == NULL)
 		return 0;
 	fmi = fli->fli_mountinfo;
@@ -650,7 +650,7 @@ fstrans_is_owner(struct mount *mp)
 
 	KASSERT(mp != dead_rootmount);
 
-	fli = fstrans_get_lwp_info(mp, true);
+	fli = fstrans_get_lwp_info(mp, false);
 	if (fli == NULL)
 		return 0;
 	fmi = fli->fli_mountinfo;



CVS commit: src/sys/kern

2022-08-22 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Aug 22 09:13:08 UTC 2022

Modified Files:
src/sys/kern: vfs_trans.c

Log Message:
Don't allocate lwp info for fstrans_held() and fstrans_is_owner().
If it doesn't exist we cannot hold a transaction or suspension.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/kern/vfs_trans.c

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



CVS commit: src/tests/dev/cgd

2022-08-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Aug 13 17:46:26 UTC 2022

Modified Files:
src/tests/dev/cgd: t_cgdconfig.sh

Log Message:
When run from py-anita/amd64 this test fails with:

  cgdconfig: getfsspecname failed: no match for `wd0e'

as the virtual machine has root on dk0, dk0 at wd0 and trying to
open wd0e fails.

This tests runs without a rump kernel and therefore should not
even try to open configured devices on the host.  Replace the
disks "wd0e" and "ld1e" with non-existant disks "dska" and "dskb".


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/dev/cgd/t_cgdconfig.sh

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

Modified files:

Index: src/tests/dev/cgd/t_cgdconfig.sh
diff -u src/tests/dev/cgd/t_cgdconfig.sh:1.3 src/tests/dev/cgd/t_cgdconfig.sh:1.4
--- src/tests/dev/cgd/t_cgdconfig.sh:1.3	Fri Aug 12 10:49:17 2022
+++ src/tests/dev/cgd/t_cgdconfig.sh	Sat Aug 13 17:46:26 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: t_cgdconfig.sh,v 1.3 2022/08/12 10:49:17 riastradh Exp $
+#	$NetBSD: t_cgdconfig.sh,v 1.4 2022/08/13 17:46:26 hannken Exp $
 #
 # Copyright (c) 2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -53,7 +53,7 @@ storedkeys_head()
 }
 storedkeys_body()
 {
-	cat 

CVS commit: src/tests/dev/cgd

2022-08-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Aug 13 17:46:26 UTC 2022

Modified Files:
src/tests/dev/cgd: t_cgdconfig.sh

Log Message:
When run from py-anita/amd64 this test fails with:

  cgdconfig: getfsspecname failed: no match for `wd0e'

as the virtual machine has root on dk0, dk0 at wd0 and trying to
open wd0e fails.

This tests runs without a rump kernel and therefore should not
even try to open configured devices on the host.  Replace the
disks "wd0e" and "ld1e" with non-existant disks "dska" and "dskb".


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/dev/cgd/t_cgdconfig.sh

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



CVS commit: src/sys/kern

2022-08-11 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Thu Aug 11 10:17:44 UTC 2022

Modified Files:
src/sys/kern: vfs_trans.c

Log Message:
Finish previous, evaluate the lowest mount on first access
to "struct mount_info" and store it here so we no longer
derefence the "struct mount" from fstrans_alloc_lwp_info().

Reported-by: syzbot+5a79214d043395b55...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/kern/vfs_trans.c

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



CVS commit: src/sys/kern

2022-08-11 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Thu Aug 11 10:17:44 UTC 2022

Modified Files:
src/sys/kern: vfs_trans.c

Log Message:
Finish previous, evaluate the lowest mount on first access
to "struct mount_info" and store it here so we no longer
derefence the "struct mount" from fstrans_alloc_lwp_info().

Reported-by: syzbot+5a79214d043395b55...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/kern/vfs_trans.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/kern/vfs_trans.c
diff -u src/sys/kern/vfs_trans.c:1.66 src/sys/kern/vfs_trans.c:1.67
--- src/sys/kern/vfs_trans.c:1.66	Fri Jul  8 07:42:47 2022
+++ src/sys/kern/vfs_trans.c	Thu Aug 11 10:17:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_trans.c,v 1.66 2022/07/08 07:42:47 hannken Exp $	*/
+/*	$NetBSD: vfs_trans.c,v 1.67 2022/08/11 10:17:44 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.66 2022/07/08 07:42:47 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.67 2022/08/11 10:17:44 hannken Exp $");
 
 /*
  * File system transaction operations.
@@ -87,6 +87,7 @@ struct fstrans_mount_info {
 	SLIST_ENTRY(fstrans_mount_info) fmi_hash;
 	LIST_HEAD(, fscow_handler) fmi_cow_handler;
 	struct mount *fmi_mount;
+	struct fstrans_mount_info *fmi_lower_info;
 	struct lwp *fmi_owner;
 };
 SLIST_HEAD(fstrans_mount_hashhead, fstrans_mount_info);
@@ -229,13 +230,29 @@ static inline struct fstrans_mount_info 
 fstrans_mount_get(struct mount *mp)
 {
 	uint32_t indx;
-	struct fstrans_mount_info *fmi;
+	struct fstrans_mount_info *fmi, *fmi_lower;
 
 	KASSERT(mutex_owned(_lock));
 
 	indx = fstrans_mount_hash(mp);
 	SLIST_FOREACH(fmi, _mount_hashtab[indx], fmi_hash) {
 		if (fmi->fmi_mount == mp) {
+			if (__predict_false(mp->mnt_lower != NULL &&
+			fmi->fmi_lower_info == NULL)) {
+/*
+ * Intern the lower/lowest mount into
+ * this mount info on first lookup.
+ */
+KASSERT(fmi->fmi_ref_cnt == 1);
+
+fmi_lower = fstrans_mount_get(mp->mnt_lower);
+if (fmi_lower && fmi_lower->fmi_lower_info)
+	fmi_lower = fmi_lower->fmi_lower_info;
+if (fmi_lower == NULL)
+	return NULL;
+fmi->fmi_lower_info = fmi_lower;
+fmi->fmi_lower_info->fmi_ref_cnt += 1;
+			}
 			return fmi;
 		}
 	}
@@ -262,6 +279,9 @@ fstrans_mount_dtor(struct fstrans_mount_
 	KASSERT(LIST_FIRST(>fmi_cow_handler) == NULL);
 	KASSERT(fmi->fmi_owner == NULL);
 
+	if (fmi->fmi_lower_info)
+		fstrans_mount_dtor(fmi->fmi_lower_info);
+
 	KASSERT(fstrans_gone_count > 0);
 	fstrans_gone_count -= 1;
 
@@ -287,6 +307,7 @@ fstrans_mount(struct mount *mp)
 	LIST_INIT(>fmi_cow_handler);
 	newfmi->fmi_cow_change = false;
 	newfmi->fmi_mount = mp;
+	newfmi->fmi_lower_info = NULL;
 	newfmi->fmi_owner = NULL;
 
 	mutex_enter(_lock);
@@ -374,7 +395,7 @@ fstrans_clear_lwp_info(void)
 static struct fstrans_lwp_info *
 fstrans_alloc_lwp_info(struct mount *mp)
 {
-	struct fstrans_lwp_info *fli;
+	struct fstrans_lwp_info *fli, *fli_lower;
 	struct fstrans_mount_info *fmi;
 
 	for (fli = curlwp->l_fstrans; fli; fli = fli->fli_succ) {
@@ -383,6 +404,32 @@ fstrans_alloc_lwp_info(struct mount *mp)
 	}
 
 	/*
+	 * Lookup mount info and get lower mount per lwp info.
+	 */
+	mutex_enter(_lock);
+	fmi = fstrans_mount_get(mp);
+	if (fmi == NULL) {
+		mutex_exit(_lock);
+		return NULL;
+	}
+	fmi->fmi_ref_cnt += 1;
+	mutex_exit(_lock);
+
+	if (fmi->fmi_lower_info) {
+		fli_lower =
+		fstrans_alloc_lwp_info(fmi->fmi_lower_info->fmi_mount);
+		if (fli_lower == NULL) {
+			mutex_enter(_lock);
+			fstrans_mount_dtor(fmi);
+			mutex_exit(_lock);
+
+			return NULL;
+		}
+	} else {
+		fli_lower = NULL;
+	}
+
+	/*
 	 * Allocate a new entry.
 	 */
 	fli = pool_cache_get(fstrans_lwp_cache, PR_WAITOK);
@@ -395,30 +442,18 @@ fstrans_alloc_lwp_info(struct mount *mp)
 	KASSERT(fli->fli_self == NULL);
 
 	/*
-	 * Attach the mount info if it is valid.
+	 * Attach the mount info and alias.
 	 */
 
-	mutex_enter(_lock);
-	fmi = fstrans_mount_get(mp);
-	if (fmi == NULL) {
-		mutex_exit(_lock);
-		pool_cache_put(fstrans_lwp_cache, fli);
-		return NULL;
-	}
 	fli->fli_self = curlwp;
 	fli->fli_mount = mp;
 	fli->fli_mountinfo = fmi;
-	fmi->fmi_ref_cnt += 1;
-	do {
-		mp = mp->mnt_lower;
-	} while (mp && mp->mnt_lower);
-	mutex_exit(_lock);
 
 	fli->fli_succ = curlwp->l_fstrans;
 	curlwp->l_fstrans = fli;
 
-	if (mp) {
-		fli->fli_alias = fstrans_alloc_lwp_info(mp);
+	if (fli_lower) {
+		fli->fli_alias = fli_lower;
 		fli->fli_alias->fli_alias_cnt++;
 		fli = fli->fli_alias;
 	}
@@ -499,9 +534,6 @@ _fstrans_start(struct mount *mp, enum fs
 
 	s = pserialize_read_enter();
 	if (__predict_true(grant_lock(fmi, lock_type))) {
-
-		KASSERT(!fmi->fmi_gone);
-
 		fli->fli_trans_cnt = 1;
 		fli->fli_lock_type = lock_type;
 		

CVS commit: src/sys/miscfs/deadfs

2022-07-08 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jul  8 07:44:18 UTC 2022

Modified Files:
src/sys/miscfs/deadfs: dead_vfsops.c

Log Message:
Make dead vfs ops "vfs_statvfs" and "vfs_vptofh" return EOPNOTSUPP.
Both operations may originate from (possible dead) vnodes.

Reported-by: syzbot+eceb203d44457742b...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/miscfs/deadfs/dead_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/miscfs/deadfs/dead_vfsops.c
diff -u src/sys/miscfs/deadfs/dead_vfsops.c:1.11 src/sys/miscfs/deadfs/dead_vfsops.c:1.12
--- src/sys/miscfs/deadfs/dead_vfsops.c:1.11	Sat Mar 19 13:53:32 2022
+++ src/sys/miscfs/deadfs/dead_vfsops.c	Fri Jul  8 07:44:17 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: dead_vfsops.c,v 1.11 2022/03/19 13:53:32 hannken Exp $	*/
+/*	$NetBSD: dead_vfsops.c,v 1.12 2022/07/08 07:44:17 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dead_vfsops.c,v 1.11 2022/03/19 13:53:32 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dead_vfsops.c,v 1.12 2022/07/08 07:44:17 hannken Exp $");
 
 #include 
 #include 
@@ -60,13 +60,13 @@ struct vfsops dead_vfsops = {
 	.vfs_unmount = (void *)dead_panic,
 	.vfs_root = (void *)dead_panic,
 	.vfs_quotactl = (void *)dead_panic,
-	.vfs_statvfs = (void *)dead_panic,
+	.vfs_statvfs = (void *)eopnotsupp,
 	.vfs_sync = (void *)dead_panic,
 	.vfs_vget = (void *)dead_panic,
 	.vfs_loadvnode = (void *)dead_panic,
 	.vfs_newvnode = dead_newvnode,
 	.vfs_fhtovp = (void *)dead_panic,
-	.vfs_vptofh = (void *)dead_panic,
+	.vfs_vptofh = (void *)eopnotsupp,
 	.vfs_init = (void *)dead_panic,
 	.vfs_reinit = (void *)dead_panic,
 	.vfs_done = (void *)dead_panic,



CVS commit: src/sys/miscfs/deadfs

2022-07-08 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jul  8 07:44:18 UTC 2022

Modified Files:
src/sys/miscfs/deadfs: dead_vfsops.c

Log Message:
Make dead vfs ops "vfs_statvfs" and "vfs_vptofh" return EOPNOTSUPP.
Both operations may originate from (possible dead) vnodes.

Reported-by: syzbot+eceb203d44457742b...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/miscfs/deadfs/dead_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/miscfs/overlay

2022-07-08 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jul  8 07:43:48 UTC 2022

Modified Files:
src/sys/miscfs/overlay: overlay_vfsops.c

Log Message:
Don't use LK_RETRY as we need an active vnode here.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/miscfs/overlay/overlay_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/miscfs/overlay/overlay_vfsops.c
diff -u src/sys/miscfs/overlay/overlay_vfsops.c:1.71 src/sys/miscfs/overlay/overlay_vfsops.c:1.72
--- src/sys/miscfs/overlay/overlay_vfsops.c:1.71	Mon Apr 13 19:23:19 2020
+++ src/sys/miscfs/overlay/overlay_vfsops.c	Fri Jul  8 07:43:48 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: overlay_vfsops.c,v 1.71 2020/04/13 19:23:19 ad Exp $	*/
+/*	$NetBSD: overlay_vfsops.c,v 1.72 2022/07/08 07:43:48 hannken Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 National Aeronautics & Space Administration
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: overlay_vfsops.c,v 1.71 2020/04/13 19:23:19 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: overlay_vfsops.c,v 1.72 2022/07/08 07:43:48 hannken Exp $");
 
 #include 
 #include 
@@ -136,7 +136,7 @@ ov_mount(struct mount *mp, const char *p
 	 */
 	lowerrootvp = mp->mnt_vnodecovered;
 	vref(lowerrootvp);
-	if ((error = vn_lock(lowerrootvp, LK_EXCLUSIVE | LK_RETRY))) {
+	if ((error = vn_lock(lowerrootvp, LK_EXCLUSIVE))) {
 		vrele(lowerrootvp);
 		return (error);
 	}



CVS commit: src/sys/miscfs/overlay

2022-07-08 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jul  8 07:43:48 UTC 2022

Modified Files:
src/sys/miscfs/overlay: overlay_vfsops.c

Log Message:
Don't use LK_RETRY as we need an active vnode here.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/miscfs/overlay/overlay_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/kern

2022-07-08 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jul  8 07:43:19 UTC 2022

Modified Files:
src/sys/kern: vfs_mount.c

Log Message:
Suspend file system after VFS_MOUNT() and before taking mnt_updating.
Prevents deadlock against concurrent unmounts of layered file systems.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/kern/vfs_mount.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/kern/vfs_mount.c
diff -u src/sys/kern/vfs_mount.c:1.93 src/sys/kern/vfs_mount.c:1.94
--- src/sys/kern/vfs_mount.c:1.93	Sat Apr  9 23:38:33 2022
+++ src/sys/kern/vfs_mount.c	Fri Jul  8 07:43:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_mount.c,v 1.93 2022/04/09 23:38:33 riastradh Exp $	*/
+/*	$NetBSD: vfs_mount.c,v 1.94 2022/07/08 07:43:19 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1997-2020 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.93 2022/04/09 23:38:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.94 2022/07/08 07:43:19 hannken Exp $");
 
 #include 
 #include 
@@ -773,12 +773,20 @@ mount_domount(struct lwp *l, vnode_t **v
 	 */
 	mp->mnt_flag = flags & (MNT_BASIC_FLAGS | MNT_FORCE | MNT_IGNORE);
 
-	mutex_enter(mp->mnt_updating);
 	error = VFS_MOUNT(mp, path, data, data_len);
 	mp->mnt_flag &= ~MNT_OP_FLAGS;
 
-	if (error != 0)
-		goto err_unmounted;
+	if (error != 0) {
+		vfs_rele(mp);
+		return error;
+	}
+
+	/* Suspend new file system before taking mnt_updating. */
+	do {
+		error2 = vfs_suspend(mp, 0);
+	} while (error2 == EINTR || error2 == ERESTART);
+	KASSERT(error2 == 0 || error2 == EOPNOTSUPP);
+	mutex_enter(mp->mnt_updating);
 
 	/*
 	 * Validate and prepare the mount point.
@@ -823,6 +831,8 @@ mount_domount(struct lwp *l, vnode_t **v
 
 	mount_checkdirs(vp);
 	mutex_exit(mp->mnt_updating);
+	if (error2 == 0)
+		vfs_resume(mp);
 
 	/* Hold an additional reference to the mount across VFS_START(). */
 	vfs_ref(mp);
@@ -840,19 +850,11 @@ mount_domount(struct lwp *l, vnode_t **v
 	return error;
 
 err_mounted:
-	do {
-		error2 = vfs_suspend(mp, 0);
-	} while (error2 == EINTR || error2 == ERESTART);
-	KASSERT(error2 == 0 || error2 == EOPNOTSUPP);
-
 	if (VFS_UNMOUNT(mp, MNT_FORCE) != 0)
 		panic("Unmounting fresh file system failed");
-
+	mutex_exit(mp->mnt_updating);
 	if (error2 == 0)
 		vfs_resume(mp);
-
-err_unmounted:
-	mutex_exit(mp->mnt_updating);
 	vfs_rele(mp);
 
 	return error;



CVS commit: src/sys/kern

2022-07-08 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jul  8 07:43:19 UTC 2022

Modified Files:
src/sys/kern: vfs_mount.c

Log Message:
Suspend file system after VFS_MOUNT() and before taking mnt_updating.
Prevents deadlock against concurrent unmounts of layered file systems.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/kern/vfs_mount.c

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



CVS commit: src/sys/kern

2022-07-08 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jul  8 07:42:47 UTC 2022

Modified Files:
src/sys/kern: vfs_trans.c

Log Message:
While one thread runs vgone() it is possible for another thread to grab
a "v_mount" that will be freed before it uses this mount for fstrans_start().

Add a hashtab to lookup our private mount data "fstrans_mount_info" and
use "mp" as an opaque key for lookup.

Reported-by: syzbot+54dc9ac0804a97b59...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/kern/vfs_trans.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/kern/vfs_trans.c
diff -u src/sys/kern/vfs_trans.c:1.65 src/sys/kern/vfs_trans.c:1.66
--- src/sys/kern/vfs_trans.c:1.65	Fri Jul  8 07:42:05 2022
+++ src/sys/kern/vfs_trans.c	Fri Jul  8 07:42:47 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_trans.c,v 1.65 2022/07/08 07:42:05 hannken Exp $	*/
+/*	$NetBSD: vfs_trans.c,v 1.66 2022/07/08 07:42:47 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.65 2022/07/08 07:42:05 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.66 2022/07/08 07:42:47 hannken Exp $");
 
 /*
  * File system transaction operations.
@@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -54,6 +55,8 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,
 
 #include 
 
+#define FSTRANS_MOUNT_HASHSIZE	32
+
 enum fstrans_lock_type {
 	FSTRANS_LAZY,			/* Granted while not suspended */
 	FSTRANS_SHARED			/* Granted while not suspending */
@@ -81,10 +84,12 @@ struct fstrans_mount_info {
 	unsigned int fmi_ref_cnt;
 	bool fmi_gone;
 	bool fmi_cow_change;
+	SLIST_ENTRY(fstrans_mount_info) fmi_hash;
 	LIST_HEAD(, fscow_handler) fmi_cow_handler;
 	struct mount *fmi_mount;
 	struct lwp *fmi_owner;
 };
+SLIST_HEAD(fstrans_mount_hashhead, fstrans_mount_info);
 
 static kmutex_t vfs_suspend_lock	/* Serialize suspensions. */
 __cacheline_aligned;
@@ -97,8 +102,12 @@ static LIST_HEAD(fstrans_lwp_head, fstra
 	/* List of all fstrans_lwp_info. */
 static pool_cache_t fstrans_lwp_cache;	/* Cache of fstrans_lwp_info. */
 
+static u_long fstrans_mount_hashmask;
+static struct fstrans_mount_hashhead *fstrans_mount_hashtab;
 static int fstrans_gone_count;		/* Number of fstrans_mount_info gone. */
 
+static inline uint32_t fstrans_mount_hash(struct mount *);
+static inline struct fstrans_mount_info *fstrans_mount_get(struct mount *);
 static void fstrans_mount_dtor(struct fstrans_mount_info *);
 static void fstrans_clear_lwp_info(void);
 static inline struct fstrans_lwp_info *
@@ -116,70 +125,6 @@ static void cow_change_done(struct fstra
 
 extern struct mount *dead_rootmount;
 
-#if defined(DIAGNOSTIC)
-
-struct fstrans_debug_mount {
-	struct mount *fdm_mount;
-	SLIST_ENTRY(fstrans_debug_mount) fdm_list;
-};
-
-static SLIST_HEAD(, fstrans_debug_mount) fstrans_debug_mount_head =
-SLIST_HEAD_INITIALIZER(fstrans_debug_mount_head);
-
-static void
-fstrans_debug_mount(struct mount *mp)
-{
-	struct fstrans_debug_mount *fdm, *new;
-
-	KASSERT(mutex_owned(_lock));
-
-	mutex_exit(_lock);
-	new = kmem_alloc(sizeof(*new), KM_SLEEP);
-	new->fdm_mount = mp;
-	mutex_enter(_lock);
-
-	SLIST_FOREACH(fdm, _debug_mount_head, fdm_list)
-		KASSERT(fdm->fdm_mount != mp);
-	SLIST_INSERT_HEAD(_debug_mount_head, new, fdm_list);
-}
-
-static void
-fstrans_debug_unmount(struct mount *mp)
-{
-	struct fstrans_debug_mount *fdm;
-
-	KASSERT(mutex_owned(_lock));
-
-	SLIST_FOREACH(fdm, _debug_mount_head, fdm_list)
-		if (fdm->fdm_mount == mp)
-			break;
-	KASSERT(fdm != NULL);
-	SLIST_REMOVE(_debug_mount_head, fdm,
-	fstrans_debug_mount, fdm_list);
-	kmem_free(fdm, sizeof(*fdm));
-}
-
-static void
-fstrans_debug_validate_mount(struct mount *mp)
-{
-	struct fstrans_debug_mount *fdm;
-
-	KASSERT(mutex_owned(_lock));
-
-	SLIST_FOREACH(fdm, _debug_mount_head, fdm_list)
-		if (fdm->fdm_mount == mp)
-			break;
-	KASSERTMSG(fdm != NULL, "mount %p invalid", mp);
-}
-
-#else /* defined(DIAGNOSTIC) */
-
-#define fstrans_debug_mount(mp)
-#define fstrans_debug_unmount(mp)
-#define fstrans_debug_validate_mount(mp)
-
-#endif  /* defined(DIAGNOSTIC) */
-
 /*
  * Initialize.
  */
@@ -197,6 +142,8 @@ fstrans_init(void)
 	coherency_unit, 0, 0, "fstlwp", NULL, IPL_NONE,
 	fstrans_lwp_pcc, fstrans_lwp_pcd, NULL);
 	KASSERT(fstrans_lwp_cache != NULL);
+	fstrans_mount_hashtab = hashinit(FSTRANS_MOUNT_HASHSIZE, HASH_SLIST,
+	true, _mount_hashmask);
 }
 
 /*
@@ -265,6 +212,38 @@ fstrans_lwp_dtor(lwp_t *l)
 }
 
 /*
+ * mount pointer to hash
+ */
+static inline uint32_t
+fstrans_mount_hash(struct mount *mp)
+{
+
+	return hash32_buf(, sizeof(mp), HASH32_BUF_INIT) &
+	fstrans_mount_hashmask;
+}
+
+/*
+ * retrieve fstrans_mount_info by mount or NULL
+ */

CVS commit: src/sys/kern

2022-07-08 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jul  8 07:42:47 UTC 2022

Modified Files:
src/sys/kern: vfs_trans.c

Log Message:
While one thread runs vgone() it is possible for another thread to grab
a "v_mount" that will be freed before it uses this mount for fstrans_start().

Add a hashtab to lookup our private mount data "fstrans_mount_info" and
use "mp" as an opaque key for lookup.

Reported-by: syzbot+54dc9ac0804a97b59...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/kern/vfs_trans.c

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



CVS commit: src/sys

2022-07-08 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jul  8 07:42:06 UTC 2022

Modified Files:
src/sys/kern: vfs_trans.c
src/sys/miscfs/genfs: genfs_vfsops.c

Log Message:
Handle IMNT_GONE on the file system we want suspended not its
lowest mount we really suspend.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/kern/vfs_trans.c
cvs rdiff -u -r1.10 -r1.11 src/sys/miscfs/genfs/genfs_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

2022-07-08 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jul  8 07:42:06 UTC 2022

Modified Files:
src/sys/kern: vfs_trans.c
src/sys/miscfs/genfs: genfs_vfsops.c

Log Message:
Handle IMNT_GONE on the file system we want suspended not its
lowest mount we really suspend.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/kern/vfs_trans.c
cvs rdiff -u -r1.10 -r1.11 src/sys/miscfs/genfs/genfs_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/kern/vfs_trans.c
diff -u src/sys/kern/vfs_trans.c:1.64 src/sys/kern/vfs_trans.c:1.65
--- src/sys/kern/vfs_trans.c:1.64	Tue Jun 28 00:13:48 2022
+++ src/sys/kern/vfs_trans.c	Fri Jul  8 07:42:05 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_trans.c,v 1.64 2022/06/28 00:13:48 riastradh Exp $	*/
+/*	$NetBSD: vfs_trans.c,v 1.65 2022/07/08 07:42:05 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.64 2022/06/28 00:13:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.65 2022/07/08 07:42:05 hannken Exp $");
 
 /*
  * File system transaction operations.
@@ -748,7 +748,6 @@ vfs_suspend(struct mount *mp, int nowait
 		return EOPNOTSUPP;
 
 	fli = fstrans_get_lwp_info(mp, true);
-	mp = fli->fli_mount;
 
 	if (nowait) {
 		if (!mutex_tryenter(_suspend_lock))
@@ -756,10 +755,17 @@ vfs_suspend(struct mount *mp, int nowait
 	} else
 		mutex_enter(_suspend_lock);
 
-	if ((error = VFS_SUSPENDCTL(mp, SUSPEND_SUSPEND)) != 0)
+	if ((error = VFS_SUSPENDCTL(fli->fli_mount, SUSPEND_SUSPEND)) != 0) {
 		mutex_exit(_suspend_lock);
+		return error;
+	}
 
-	return error;
+	if ((mp->mnt_iflag & IMNT_GONE) != 0) {
+		vfs_resume(mp);
+		return ENOENT;
+	}
+
+	return 0;
 }
 
 /*

Index: src/sys/miscfs/genfs/genfs_vfsops.c
diff -u src/sys/miscfs/genfs/genfs_vfsops.c:1.10 src/sys/miscfs/genfs/genfs_vfsops.c:1.11
--- src/sys/miscfs/genfs/genfs_vfsops.c:1.10	Sun Dec 22 19:47:34 2019
+++ src/sys/miscfs/genfs/genfs_vfsops.c	Fri Jul  8 07:42:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfs_vfsops.c,v 1.10 2019/12/22 19:47:34 ad Exp $	*/
+/*	$NetBSD: genfs_vfsops.c,v 1.11 2022/07/08 07:42:06 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfs_vfsops.c,v 1.10 2019/12/22 19:47:34 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_vfsops.c,v 1.11 2022/07/08 07:42:06 hannken Exp $");
 
 #include 
 #include 
@@ -76,7 +76,6 @@ int
 genfs_suspendctl(struct mount *mp, int cmd)
 {
 	int error;
-	int error2 __diagused;
 
 	switch (cmd) {
 	case SUSPEND_SUSPEND:
@@ -84,19 +83,11 @@ genfs_suspendctl(struct mount *mp, int c
 		if (error)
 			return error;
 		error = fstrans_setstate(mp, FSTRANS_SUSPENDED);
-		if (error == 0) {
-			if ((mp->mnt_iflag & IMNT_GONE) != 0)
-error = ENOENT;
-			if (error) {
-error2 = fstrans_setstate(mp, FSTRANS_NORMAL);
-KASSERT(error2 == 0);
-			}
-		}
 		return error;
 
 	case SUSPEND_RESUME:
-		error2 = fstrans_setstate(mp, FSTRANS_NORMAL);
-		KASSERT(error2 == 0);
+		error = fstrans_setstate(mp, FSTRANS_NORMAL);
+		KASSERT(error == 0);
 		return 0;
 
 	default:



CVS commit: src/sys/dev/usb

2022-07-06 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Jul  6 15:24:14 UTC 2022

Modified Files:
src/sys/dev/usb: uplcom.c

Log Message:
Add missing brace.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/usb/uplcom.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/dev/usb/uplcom.c
diff -u src/sys/dev/usb/uplcom.c:1.93 src/sys/dev/usb/uplcom.c:1.94
--- src/sys/dev/usb/uplcom.c:1.93	Wed Jul  6 06:25:24 2022
+++ src/sys/dev/usb/uplcom.c	Wed Jul  6 15:24:14 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: uplcom.c,v 1.93 2022/07/06 06:25:24 nat Exp $	*/
+/*	$NetBSD: uplcom.c,v 1.94 2022/07/06 15:24:14 hannken Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.93 2022/07/06 06:25:24 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.94 2022/07/06 15:24:14 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -335,7 +335,7 @@ uplcom_attach(device_t parent, device_t 
 	/* print the chip type */
 	if (sc->sc_type == UPLCOM_TYPE_HXN) {
 		DPRINTF("chiptype HXN", 0, 0, 0, 0);
-	else if (sc->sc_type == UPLCOM_TYPE_HX) {
+	} else if (sc->sc_type == UPLCOM_TYPE_HX) {
 		DPRINTF("chiptype HX", 0, 0, 0, 0);
 	} else {
 		DPRINTF("chiptype 0", 0, 0, 0, 0);



CVS commit: src/sys/dev/usb

2022-07-06 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Jul  6 15:24:14 UTC 2022

Modified Files:
src/sys/dev/usb: uplcom.c

Log Message:
Add missing brace.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/usb/uplcom.c

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



CVS commit: src/sys/kern

2022-06-29 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Jun 29 16:33:09 UTC 2022

Modified Files:
src/sys/kern: sys_syscall.c

Log Message:
Synchronize SYS_SYSCALL() with other syscall implementations and
call trace_exit() even if trace_enter() returned an error.

PR kern/52166 "syscallemu does not work on sparc (32-bit)"
PR toolchain/56117 "New test failures on amd64 since switch to gcc10"


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/kern/sys_syscall.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/kern/sys_syscall.c
diff -u src/sys/kern/sys_syscall.c:1.14 src/sys/kern/sys_syscall.c:1.15
--- src/sys/kern/sys_syscall.c:1.14	Mon Mar 14 12:02:19 2022
+++ src/sys/kern/sys_syscall.c	Wed Jun 29 16:33:09 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_syscall.c,v 1.14 2022/03/14 12:02:19 riastradh Exp $	*/
+/*	$NetBSD: sys_syscall.c,v 1.15 2022/06/29 16:33:09 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_syscall.c,v 1.14 2022/03/14 12:02:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_syscall.c,v 1.15 2022/06/29 16:33:09 hannken Exp $");
 
 #include 
 #include 
@@ -99,9 +99,8 @@ SYS_SYSCALL(struct lwp *l, const struct 
 #endif
 
 	error = trace_enter(code, callp, TRACE_ARGS);
-	if (__predict_false(error != 0))
-		return error;
-	error = sy_call(callp, l, >args, rval);
+	if (__predict_true(error == 0))
+		error = sy_call(callp, l, >args, rval);
 	trace_exit(code, callp, >args, rval, error);
 	CONCAT(SYS_SYSCALL, _biglockcheck)(p, code);
 	return error;



CVS commit: src/sys/kern

2022-06-29 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Jun 29 16:33:09 UTC 2022

Modified Files:
src/sys/kern: sys_syscall.c

Log Message:
Synchronize SYS_SYSCALL() with other syscall implementations and
call trace_exit() even if trace_enter() returned an error.

PR kern/52166 "syscallemu does not work on sparc (32-bit)"
PR toolchain/56117 "New test failures on amd64 since switch to gcc10"


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/kern/sys_syscall.c

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



CVS commit: src/sys/nfs

2022-06-24 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jun 24 16:50:00 UTC 2022

Modified Files:
src/sys/nfs: nfs_bio.c

Log Message:
Remove an incorrect assertion.

Just issue a readahead near the end of the vnode and enqueue an async read.
Now let nfs_setattr() truncate the vnode, set its new size and
nfs_vinvalbuf() waits for the pages from the readahead to become unbusy.

The async read gets processed and returns with uio_resid > 0 because there
is a hole and no write after the hole has been pushed yet.  As the vnode
size already got truncated to the new size the KASSERT() incorrectly fires.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/nfs/nfs_bio.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/nfs/nfs_bio.c
diff -u src/sys/nfs/nfs_bio.c:1.200 src/sys/nfs/nfs_bio.c:1.201
--- src/sys/nfs/nfs_bio.c:1.200	Wed Oct 20 03:08:18 2021
+++ src/sys/nfs/nfs_bio.c	Fri Jun 24 16:50:00 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_bio.c,v 1.200 2021/10/20 03:08:18 thorpej Exp $	*/
+/*	$NetBSD: nfs_bio.c,v 1.201 2022/06/24 16:50:00 hannken Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.200 2021/10/20 03:08:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.201 2022/06/24 16:50:00 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_nfs.h"
@@ -878,8 +878,6 @@ nfs_doio_read(struct buf *bp, struct uio
 			 * Just zero fill the rest of the valid area.
 			 */
 
-			KASSERT(vp->v_size >=
-			uiop->uio_offset + uiop->uio_resid);
 			diff = bp->b_bcount - uiop->uio_resid;
 			len = uiop->uio_resid;
 			memset((char *)bp->b_data + diff, 0, len);



CVS commit: src/sys/nfs

2022-06-24 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jun 24 16:50:00 UTC 2022

Modified Files:
src/sys/nfs: nfs_bio.c

Log Message:
Remove an incorrect assertion.

Just issue a readahead near the end of the vnode and enqueue an async read.
Now let nfs_setattr() truncate the vnode, set its new size and
nfs_vinvalbuf() waits for the pages from the readahead to become unbusy.

The async read gets processed and returns with uio_resid > 0 because there
is a hole and no write after the hole has been pushed yet.  As the vnode
size already got truncated to the new size the KASSERT() incorrectly fires.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/nfs/nfs_bio.c

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



CVS commit: src/usr.sbin/sysinst/arch/sparc64

2022-06-17 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jun 17 09:00:08 UTC 2022

Modified Files:
src/usr.sbin/sysinst/arch/sparc64: md.h

Log Message:
Remove now obsolete "#define DEFSWAPSIZE (-1)" to fix the build.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/sparc64/md.h

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

Modified files:

Index: src/usr.sbin/sysinst/arch/sparc64/md.h
diff -u src/usr.sbin/sysinst/arch/sparc64/md.h:1.6 src/usr.sbin/sysinst/arch/sparc64/md.h:1.7
--- src/usr.sbin/sysinst/arch/sparc64/md.h:1.6	Thu Jun 16 14:03:39 2022
+++ src/usr.sbin/sysinst/arch/sparc64/md.h	Fri Jun 17 09:00:08 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.h,v 1.6 2022/06/16 14:03:39 tsutsui Exp $	*/
+/*	$NetBSD: md.h,v 1.7 2022/06/17 09:00:08 hannken Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -36,7 +36,6 @@
 /* md.h -- Machine specific definitions for the sparc */
 
 /* Constants and defines */
-#define	DEFSWAPSIZE	(-1)
 
 /*
  * Symbolic names for disk partitions.



CVS commit: src/usr.sbin/sysinst/arch/sparc64

2022-06-17 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jun 17 09:00:08 UTC 2022

Modified Files:
src/usr.sbin/sysinst/arch/sparc64: md.h

Log Message:
Remove now obsolete "#define DEFSWAPSIZE (-1)" to fix the build.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/sparc64/md.h

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



CVS commit: src/lib/libpam/modules/pam_ssh

2022-06-15 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Jun 15 08:31:34 UTC 2022

Modified Files:
src/lib/libpam/modules/pam_ssh: pam_ssh.c

Log Message:
Set provider to NULL -- "pam" is not a valid security key helper library.
Now ssh-agent no longer fails key addition with

error: Cannot add provider: RSA is not an authenticator-hosted key


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libpam/modules/pam_ssh/pam_ssh.c

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

Modified files:

Index: src/lib/libpam/modules/pam_ssh/pam_ssh.c
diff -u src/lib/libpam/modules/pam_ssh/pam_ssh.c:1.29 src/lib/libpam/modules/pam_ssh/pam_ssh.c:1.30
--- src/lib/libpam/modules/pam_ssh/pam_ssh.c:1.29	Thu Feb 24 00:26:26 2022
+++ src/lib/libpam/modules/pam_ssh/pam_ssh.c	Wed Jun 15 08:31:34 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pam_ssh.c,v 1.29 2022/02/24 00:26:26 christos Exp $	*/
+/*	$NetBSD: pam_ssh.c,v 1.30 2022/06/15 08:31:34 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2003 Networks Associates Technology, Inc.
@@ -38,7 +38,7 @@
 #ifdef __FreeBSD__
 __FBSDID("$FreeBSD: src/lib/libpam/modules/pam_ssh/pam_ssh.c,v 1.40 2004/02/10 10:13:21 des Exp $");
 #else
-__RCSID("$NetBSD: pam_ssh.c,v 1.29 2022/02/24 00:26:26 christos Exp $");
+__RCSID("$NetBSD: pam_ssh.c,v 1.30 2022/06/15 08:31:34 hannken Exp $");
 #endif
 
 #include 
@@ -68,7 +68,7 @@ __RCSID("$NetBSD: pam_ssh.c,v 1.29 2022/
 #include "authfile.h"
 
 #define ssh_add_identity(auth, key, comment) \
-ssh_add_identity_constrained(auth, key, comment, 0, 0, 0, "pam", NULL, 00)
+ssh_add_identity_constrained(auth, key, comment, 0, 0, 0, NULL, NULL, 00)
 
 extern char **environ;
 



CVS commit: src/lib/libpam/modules/pam_ssh

2022-06-15 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Jun 15 08:31:34 UTC 2022

Modified Files:
src/lib/libpam/modules/pam_ssh: pam_ssh.c

Log Message:
Set provider to NULL -- "pam" is not a valid security key helper library.
Now ssh-agent no longer fails key addition with

error: Cannot add provider: RSA is not an authenticator-hosted key


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libpam/modules/pam_ssh/pam_ssh.c

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



CVS commit: src/sys/fs/tmpfs

2022-06-01 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Jun  1 08:42:38 UTC 2022

Modified Files:
src/sys/fs/tmpfs: tmpfs_vnops.c

Log Message:
tmpfs_read: respect MNT_NOATIME.


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/fs/tmpfs/tmpfs_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/fs/tmpfs/tmpfs_vnops.c
diff -u src/sys/fs/tmpfs/tmpfs_vnops.c:1.149 src/sys/fs/tmpfs/tmpfs_vnops.c:1.150
--- src/sys/fs/tmpfs/tmpfs_vnops.c:1.149	Sun Mar 27 16:24:57 2022
+++ src/sys/fs/tmpfs/tmpfs_vnops.c	Wed Jun  1 08:42:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_vnops.c,v 1.149 2022/03/27 16:24:57 christos Exp $	*/
+/*	$NetBSD: tmpfs_vnops.c,v 1.150 2022/06/01 08:42:38 hannken Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007, 2020 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.149 2022/03/27 16:24:57 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.150 2022/06/01 08:42:38 hannken Exp $");
 
 #include 
 #include 
@@ -555,7 +555,9 @@ tmpfs_read(void *v)
 		UBC_READ | UBC_PARTIALOK | UBC_VNODE_FLAGS(vp));
 	}
 
-	tmpfs_update(vp, TMPFS_UPDATE_ATIME);
+	if ((vp->v_mount->mnt_flag & MNT_NOATIME) == 0)
+		tmpfs_update(vp, TMPFS_UPDATE_ATIME);
+
 	return error;
 }
 



CVS commit: src/sys/fs/tmpfs

2022-06-01 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Jun  1 08:42:38 UTC 2022

Modified Files:
src/sys/fs/tmpfs: tmpfs_vnops.c

Log Message:
tmpfs_read: respect MNT_NOATIME.


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/fs/tmpfs/tmpfs_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/dev/ic

2022-05-22 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun May 22 08:59:34 UTC 2022

Modified Files:
src/sys/dev/ic: mfi.c

Log Message:
Use PRIxBUSADDR for bus_addr_t in debug printf.

Kernel i386/ALL compiles again.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/ic/mfi.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/dev/ic/mfi.c
diff -u src/sys/dev/ic/mfi.c:1.77 src/sys/dev/ic/mfi.c:1.78
--- src/sys/dev/ic/mfi.c:1.77	Fri May 13 10:41:42 2022
+++ src/sys/dev/ic/mfi.c	Sun May 22 08:59:34 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.77 2022/05/13 10:41:42 msaitoh Exp $ */
+/* $NetBSD: mfi.c,v 1.78 2022/05/22 08:59:34 hannken Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 
 /*
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.77 2022/05/13 10:41:42 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.78 2022/05/22 08:59:34 hannken Exp $");
 
 #include "bio.h"
 
@@ -516,8 +516,8 @@ mfi_allocmem(struct mfi_softc *sc, size_
 	BUS_DMA_NOWAIT) != 0)
 		goto unmap;
 
-	DNPRINTF(MFI_D_MEM, "  kva: %p  dva: %p  map: %p\n",
-	mm->am_kva, (void *)mm->am_map->dm_segs[0].ds_addr, mm->am_map);
+	DNPRINTF(MFI_D_MEM, "  kva: %p  dva: %" PRIxBUSADDR "  map: %p\n",
+	mm->am_kva, mm->am_map->dm_segs[0].ds_addr, mm->am_map);
 
 	memset(mm->am_kva, 0, size);
 	return mm;



CVS commit: src/sys/dev/ic

2022-05-22 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun May 22 08:59:34 UTC 2022

Modified Files:
src/sys/dev/ic: mfi.c

Log Message:
Use PRIxBUSADDR for bus_addr_t in debug printf.

Kernel i386/ALL compiles again.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/ic/mfi.c

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



CVS commit: src/sys

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 13:55:29 UTC 2022

Modified Files:
src/sys/kern: vnode_if.c
src/sys/rump/include/rump: rumpvnode_if.h
src/sys/rump/librump/rumpvfs: rumpvnode_if.c
src/sys/sys: vnode_if.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/kern/vnode_if.c
cvs rdiff -u -r1.38 -r1.39 src/sys/rump/include/rump/rumpvnode_if.h
cvs rdiff -u -r1.38 -r1.39 src/sys/rump/librump/rumpvfs/rumpvnode_if.c
cvs rdiff -u -r1.109 -r1.110 src/sys/sys/vnode_if.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/kern/vnode_if.c
diff -u src/sys/kern/vnode_if.c:1.116 src/sys/kern/vnode_if.c:1.117
--- src/sys/kern/vnode_if.c:1.116	Tue May  3 08:35:11 2022
+++ src/sys/kern/vnode_if.c	Tue May  3 13:55:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnode_if.c,v 1.116 2022/05/03 08:35:11 hannken Exp $	*/
+/*	$NetBSD: vnode_if.c,v 1.117 2022/05/03 13:55:29 hannken Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
@@ -7,7 +7,7 @@
  * Created from the file:
  *	NetBSD: vnode_if.src,v 1.84 2022/05/03 08:33:59 hannken Exp
  * by the script:
- *	NetBSD: vnode_if.sh,v 1.74 2022/05/03 08:33:59 hannken Exp
+ *	NetBSD: vnode_if.sh,v 1.75 2022/05/03 13:54:18 hannken Exp
  */
 
 /*
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.116 2022/05/03 08:35:11 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.117 2022/05/03 13:55:29 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_vnode_lockdebug.h"
@@ -303,28 +303,34 @@ vop_post(vnode_t *vp, struct mount *mp, 
 static inline void
 assert_vop_unlocked(vnode_t *vp, const char *str)
 {
+#if defined(VNODE_LOCKDEBUG)
 
 	if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE)
 		panic("%s: %p %d/%d is locked but should not be",
 		str, vp, vp->v_tag, vp->v_type);
+#endif
 }
 
 static inline void
 assert_vop_locked(vnode_t *vp, const char *str)
 {
+#if defined(VNODE_LOCKDEBUG)
 
 	if (VOP_ISLOCKED(vp) == LK_NONE)
 		panic("%s: %p %d/%d is not locked but should be",
 		str, vp, vp->v_tag, vp->v_type);
+#endif
 }
 
 static inline void
 assert_vop_elocked(vnode_t *vp, const char *str)
 {
+#if defined(VNODE_LOCKDEBUG)
 
 	if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE)
 		panic("%s: %p %d/%d is not exclusive locked but should be",
 		str, vp, vp->v_tag, vp->v_type);
+#endif
 }
 
 const struct vnodeop_desc vop_default_desc = {

Index: src/sys/rump/include/rump/rumpvnode_if.h
diff -u src/sys/rump/include/rump/rumpvnode_if.h:1.38 src/sys/rump/include/rump/rumpvnode_if.h:1.39
--- src/sys/rump/include/rump/rumpvnode_if.h:1.38	Tue May  3 08:35:11 2022
+++ src/sys/rump/include/rump/rumpvnode_if.h	Tue May  3 13:55:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpvnode_if.h,v 1.38 2022/05/03 08:35:11 hannken Exp $	*/
+/*	$NetBSD: rumpvnode_if.h,v 1.39 2022/05/03 13:55:29 hannken Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
@@ -7,7 +7,7 @@
  * Created from the file:
  *	NetBSD: vnode_if.src,v 1.84 2022/05/03 08:33:59 hannken Exp
  * by the script:
- *	NetBSD: vnode_if.sh,v 1.74 2022/05/03 08:33:59 hannken Exp
+ *	NetBSD: vnode_if.sh,v 1.75 2022/05/03 13:54:18 hannken Exp
  */
 
 /*

Index: src/sys/rump/librump/rumpvfs/rumpvnode_if.c
diff -u src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.38 src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.39
--- src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.38	Tue May  3 08:35:11 2022
+++ src/sys/rump/librump/rumpvfs/rumpvnode_if.c	Tue May  3 13:55:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpvnode_if.c,v 1.38 2022/05/03 08:35:11 hannken Exp $	*/
+/*	$NetBSD: rumpvnode_if.c,v 1.39 2022/05/03 13:55:29 hannken Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
@@ -7,7 +7,7 @@
  * Created from the file:
  *	NetBSD: vnode_if.src,v 1.84 2022/05/03 08:33:59 hannken Exp
  * by the script:
- *	NetBSD: vnode_if.sh,v 1.74 2022/05/03 08:33:59 hannken Exp
+ *	NetBSD: vnode_if.sh,v 1.75 2022/05/03 13:54:18 hannken Exp
  */
 
 /*
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpvnode_if.c,v 1.38 2022/05/03 08:35:11 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpvnode_if.c,v 1.39 2022/05/03 13:55:29 hannken Exp $");
 
 #include 
 #include 

Index: src/sys/sys/vnode_if.h
diff -u src/sys/sys/vnode_if.h:1.109 src/sys/sys/vnode_if.h:1.110
--- src/sys/sys/vnode_if.h:1.109	Tue May  3 08:35:11 2022
+++ src/sys/sys/vnode_if.h	Tue May  3 13:55:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnode_if.h,v 1.109 2022/05/03 08:35:11 hannken Exp $	*/
+/*	$NetBSD: vnode_if.h,v 1.110 2022/05/03 13:55:29 hannken Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
@@ -7,7 +7,7 @@
  * Created from the file:
  *	NetBSD: vnode_if.src,v 1.84 2022/05/03 08:33:59 hannken Exp
  * by the script:
- *	NetBSD: vnode_if.sh,v 1.74 2022/05/03 08:33:59 hannken Exp
+ *	NetBSD: 

CVS commit: src/sys

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 13:55:29 UTC 2022

Modified Files:
src/sys/kern: vnode_if.c
src/sys/rump/include/rump: rumpvnode_if.h
src/sys/rump/librump/rumpvfs: rumpvnode_if.c
src/sys/sys: vnode_if.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/kern/vnode_if.c
cvs rdiff -u -r1.38 -r1.39 src/sys/rump/include/rump/rumpvnode_if.h
cvs rdiff -u -r1.38 -r1.39 src/sys/rump/librump/rumpvfs/rumpvnode_if.c
cvs rdiff -u -r1.109 -r1.110 src/sys/sys/vnode_if.h

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



CVS commit: src/sys/kern

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 13:54:18 UTC 2022

Modified Files:
src/sys/kern: vnode_if.sh

Log Message:
Really depend the lockdebug checks on option VNODE_LOCKDEBUG -- were
enabled by accident.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/kern/vnode_if.sh

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



CVS commit: src/sys/kern

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 13:54:18 UTC 2022

Modified Files:
src/sys/kern: vnode_if.sh

Log Message:
Really depend the lockdebug checks on option VNODE_LOCKDEBUG -- were
enabled by accident.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/kern/vnode_if.sh

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

Modified files:

Index: src/sys/kern/vnode_if.sh
diff -u src/sys/kern/vnode_if.sh:1.74 src/sys/kern/vnode_if.sh:1.75
--- src/sys/kern/vnode_if.sh:1.74	Tue May  3 08:33:59 2022
+++ src/sys/kern/vnode_if.sh	Tue May  3 13:54:18 2022
@@ -29,7 +29,7 @@ copyright="\
  * SUCH DAMAGE.
  */
 "
-SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.74 2022/05/03 08:33:59 hannken Exp $'
+SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.75 2022/05/03 13:54:18 hannken Exp $'
 
 # Script to produce VFS front-end sugar.
 #
@@ -610,28 +610,34 @@ vop_post(vnode_t *vp, struct mount *mp, 
 static inline void
 assert_vop_unlocked(vnode_t *vp, const char *str)
 {
+#if defined(VNODE_LOCKDEBUG)
 
 	if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE)
 		panic(\"%s: %p %d/%d is locked but should not be\",
 		str, vp, vp->v_tag, vp->v_type);
+#endif
 }
 
 static inline void
 assert_vop_locked(vnode_t *vp, const char *str)
 {
+#if defined(VNODE_LOCKDEBUG)
 
 	if (VOP_ISLOCKED(vp) == LK_NONE)
 		panic(\"%s: %p %d/%d is not locked but should be\",
 		str, vp, vp->v_tag, vp->v_type);
+#endif
 }
 
 static inline void
 assert_vop_elocked(vnode_t *vp, const char *str)
 {
+#if defined(VNODE_LOCKDEBUG)
 
 	if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE)
 		panic(\"%s: %p %d/%d is not exclusive locked but should be\",
 		str, vp, vp->v_tag, vp->v_type);
+#endif
 }
 
 const struct vnodeop_desc vop_default_desc = {"



CVS commit: src/sys

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 08:35:11 UTC 2022

Modified Files:
src/sys/kern: vnode_if.c
src/sys/rump/include/rump: rumpvnode_if.h
src/sys/rump/librump/rumpvfs: rumpvnode_if.c
src/sys/sys: vnode_if.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/kern/vnode_if.c
cvs rdiff -u -r1.37 -r1.38 src/sys/rump/include/rump/rumpvnode_if.h
cvs rdiff -u -r1.37 -r1.38 src/sys/rump/librump/rumpvfs/rumpvnode_if.c
cvs rdiff -u -r1.108 -r1.109 src/sys/sys/vnode_if.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/kern/vnode_if.c
diff -u src/sys/kern/vnode_if.c:1.115 src/sys/kern/vnode_if.c:1.116
--- src/sys/kern/vnode_if.c:1.115	Wed Oct 20 03:13:14 2021
+++ src/sys/kern/vnode_if.c	Tue May  3 08:35:11 2022
@@ -1,13 +1,13 @@
-/*	$NetBSD: vnode_if.c,v 1.115 2021/10/20 03:13:14 thorpej Exp $	*/
+/*	$NetBSD: vnode_if.c,v 1.116 2022/05/03 08:35:11 hannken Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
  * (Modifications made here may easily be lost!)
  *
  * Created from the file:
- *	NetBSD: vnode_if.src,v 1.83 2021/10/20 03:08:18 thorpej Exp
+ *	NetBSD: vnode_if.src,v 1.84 2022/05/03 08:33:59 hannken Exp
  * by the script:
- *	NetBSD: vnode_if.sh,v 1.72 2021/10/20 03:08:18 thorpej Exp
+ *	NetBSD: vnode_if.sh,v 1.74 2022/05/03 08:33:59 hannken Exp
  */
 
 /*
@@ -40,7 +40,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.115 2021/10/20 03:13:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.116 2022/05/03 08:35:11 hannken Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_vnode_lockdebug.h"
+#endif /* _KERNEL_OPT */
 
 #include 
 #include 
@@ -296,6 +300,33 @@ vop_post(vnode_t *vp, struct mount *mp, 
 	}
 }
 
+static inline void
+assert_vop_unlocked(vnode_t *vp, const char *str)
+{
+
+	if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE)
+		panic("%s: %p %d/%d is locked but should not be",
+		str, vp, vp->v_tag, vp->v_type);
+}
+
+static inline void
+assert_vop_locked(vnode_t *vp, const char *str)
+{
+
+	if (VOP_ISLOCKED(vp) == LK_NONE)
+		panic("%s: %p %d/%d is not locked but should be",
+		str, vp, vp->v_tag, vp->v_type);
+}
+
+static inline void
+assert_vop_elocked(vnode_t *vp, const char *str)
+{
+
+	if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE)
+		panic("%s: %p %d/%d is not exclusive locked but should be",
+		str, vp, vp->v_tag, vp->v_type);
+}
+
 const struct vnodeop_desc vop_default_desc = {
 	0,
 	"default",
@@ -399,6 +430,7 @@ VOP_LOOKUP(struct vnode *dvp,
 	a.a_dvp = dvp;
 	a.a_vpp = vpp;
 	a.a_cnp = cnp;
+	assert_vop_locked(dvp, "vop_lookup: dvp");
 	error = vop_pre(dvp, , , FST_NO);
 	if (error)
 		return error;
@@ -440,6 +472,7 @@ VOP_CREATE(struct vnode *dvp,
 	a.a_vpp = vpp;
 	a.a_cnp = cnp;
 	a.a_vap = vap;
+	assert_vop_elocked(dvp, "vop_create: dvp");
 	error = vop_pre(dvp, , , FST_NO);
 	if (error)
 		return error;
@@ -482,6 +515,7 @@ VOP_MKNOD(struct vnode *dvp,
 	a.a_vpp = vpp;
 	a.a_cnp = cnp;
 	a.a_vap = vap;
+	assert_vop_elocked(dvp, "vop_mknod: dvp");
 	error = vop_pre(dvp, , , FST_NO);
 	if (error)
 		return error;
@@ -522,6 +556,7 @@ VOP_OPEN(struct vnode *vp,
 	a.a_vp = vp;
 	a.a_mode = mode;
 	a.a_cred = cred;
+	assert_vop_locked(vp, "vop_open: vp");
 	error = vop_pre(vp, , , FST_NO);
 	if (error)
 		return error;
@@ -557,6 +592,7 @@ VOP_CLOSE(struct vnode *vp,
 	a.a_vp = vp;
 	a.a_fflag = fflag;
 	a.a_cred = cred;
+	assert_vop_locked(vp, "vop_close: vp");
 	error = vop_pre(vp, , , FST_NO);
 	if (error)
 		return error;
@@ -592,6 +628,7 @@ VOP_ACCESS(struct vnode *vp,
 	a.a_vp = vp;
 	a.a_accmode = accmode;
 	a.a_cred = cred;
+	assert_vop_locked(vp, "vop_access: vp");
 	error = vop_pre(vp, , , FST_NO);
 	if (error)
 		return error;
@@ -626,6 +663,7 @@ VOP_ACCESSX(struct vnode *vp,
 	a.a_vp = vp;
 	a.a_accmode = accmode;
 	a.a_cred = cred;
+	assert_vop_locked(vp, "vop_accessx: vp");
 	error = vop_pre(vp, , , FST_NO);
 	if (error)
 		return error;
@@ -660,6 +698,7 @@ VOP_GETATTR(struct vnode *vp,
 	a.a_vp = vp;
 	a.a_vap = vap;
 	a.a_cred = cred;
+	assert_vop_locked(vp, "vop_getattr: vp");
 	error = vop_pre(vp, , , FST_NO);
 	if (error)
 		return error;
@@ -694,6 +733,7 @@ VOP_SETATTR(struct vnode *vp,
 	a.a_vp = vp;
 	a.a_vap = vap;
 	a.a_cred = cred;
+	assert_vop_elocked(vp, "vop_setattr: vp");
 	vop_setattr_pre();
 	error = vop_pre(vp, , , FST_NO);
 	if (error)
@@ -732,6 +772,7 @@ VOP_READ(struct vnode *vp,
 	a.a_uio = uio;
 	a.a_ioflag = ioflag;
 	a.a_cred = cred;
+	assert_vop_locked(vp, "vop_read: vp");
 	error = vop_pre(vp, , , FST_NO);
 	if (error)
 		return error;
@@ -769,6 +810,7 @@ VOP_WRITE(struct vnode *vp,
 	a.a_uio = uio;
 	a.a_ioflag = ioflag;
 	a.a_cred = cred;
+	assert_vop_locked(vp, "vop_write: vp");
 	vop_write_pre();
 	error = vop_pre(vp, , , FST_NO);
 	if (error)
@@ -805,6 +847,7 @@ VOP_FALLOCATE(struct vnode *vp,
 	

CVS commit: src/sys

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 08:35:11 UTC 2022

Modified Files:
src/sys/kern: vnode_if.c
src/sys/rump/include/rump: rumpvnode_if.h
src/sys/rump/librump/rumpvfs: rumpvnode_if.c
src/sys/sys: vnode_if.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/kern/vnode_if.c
cvs rdiff -u -r1.37 -r1.38 src/sys/rump/include/rump/rumpvnode_if.h
cvs rdiff -u -r1.37 -r1.38 src/sys/rump/librump/rumpvfs/rumpvnode_if.c
cvs rdiff -u -r1.108 -r1.109 src/sys/sys/vnode_if.h

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



CVS commit: src/sys

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 08:34:00 UTC 2022

Modified Files:
src/sys/kern: vnode_if.sh vnode_if.src
src/sys/rump: Makefile.rump README.compileopts

Log Message:
Make option VNODE_LOCKDEBUG more functional.

- Add "LOCKED=EXCL" option for vnode operations needing exclusive locked nodes.

- As it is impossible to check for shared locks held by current thread avoid
  false assertions by testing for exclusive lock only in the "LOCKED=NO" case.

- New option "RUMP_VNODE_LOCKDEBUG" enables VNODE_LOCKDEBUG for the rump kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/kern/vnode_if.sh
cvs rdiff -u -r1.83 -r1.84 src/sys/kern/vnode_if.src
cvs rdiff -u -r1.133 -r1.134 src/sys/rump/Makefile.rump
cvs rdiff -u -r1.14 -r1.15 src/sys/rump/README.compileopts

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

Modified files:

Index: src/sys/kern/vnode_if.sh
diff -u src/sys/kern/vnode_if.sh:1.73 src/sys/kern/vnode_if.sh:1.74
--- src/sys/kern/vnode_if.sh:1.73	Sat Mar 19 13:53:32 2022
+++ src/sys/kern/vnode_if.sh	Tue May  3 08:33:59 2022
@@ -29,7 +29,7 @@ copyright="\
  * SUCH DAMAGE.
  */
 "
-SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.73 2022/03/19 13:53:32 hannken Exp $'
+SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.74 2022/05/03 08:33:59 hannken Exp $'
 
 # Script to produce VFS front-end sugar.
 #
@@ -53,7 +53,7 @@ out_h=../sys/vnode_if.h
 out_rumph=../rump/include/rump/rumpvnode_if.h
 
 # generate VNODE_LOCKDEBUG checks (not fully functional)
-lockdebug=0
+lockdebug=1
 
 # Awk program (must support nawk extensions)
 # Use "awk" at Berkeley, "nawk" or "gawk" elsewhere.
@@ -150,14 +150,17 @@ awk_parser='
 	i=2;
 
 	if (is_context == 0) {
-		if ($2 == "LOCKED=YES") {
-			lockstate[argc] = 1;
+		if ($2 == "LOCKED=EXCL") {
+			lockstate[argc] = "elocked";
+			i++;
+		} else if ($2 == "LOCKED=YES") {
+			lockstate[argc] = "locked";
 			i++;
 		} else if ($2 == "LOCKED=NO") {
-			lockstate[argc] = 0;
+			lockstate[argc] = "unlocked";
 			i++;
 		} else
-			lockstate[argc] = -1;
+			lockstate[argc] = "";
 
 		if ($2 == "WILLRELE" ||
 		$3 == "WILLRELE") {
@@ -175,7 +178,8 @@ awk_parser='
 			i++;
 		}
 		if (argc == 0 && fstrans == "") {
-			if (lockstate[0] == 1)
+			if (lockstate[0] == "locked" ||
+			 lockstate[0] == "elocked")
 fstrans = "NO";
 			else
 fstrans = "YES";
@@ -249,12 +253,6 @@ echo -n "$copyright"
 echo ''
 echo "#ifndef _${SYS}VNODE_IF_H_"
 echo "#define _${SYS}VNODE_IF_H_"
-if [ ${lockdebug} -ne 0 ] ; then
-	echo ''
-	echo '#ifdef _KERNEL_OPT'
-	echo '#include "opt_vnode_lockdebug.h"'
-	echo '#endif /* _KERNEL_OPT */'
-fi
 [ -z "${rump}" ] && echo "
 extern const struct vnodeop_desc ${rump}vop_default_desc;"
 echo
@@ -343,7 +341,12 @@ echo "
 #include 
 __KERNEL_RCSID(0, \"\$NetBSD\$\");"
 
-[ ${lockdebug} -ne 0 ] && echo && echo '#include "opt_vnode_lockdebug.h"'
+if [ -z "${rump}" -a ${lockdebug} -ne 0 ] ; then
+	echo ''
+	echo '#ifdef _KERNEL_OPT'
+	echo '#include "opt_vnode_lockdebug.h"'
+	echo '#endif /* _KERNEL_OPT */'
+fi
 
 echo '
 #include 
@@ -604,6 +607,33 @@ vop_post(vnode_t *vp, struct mount *mp, 
 	}
 }
 
+static inline void
+assert_vop_unlocked(vnode_t *vp, const char *str)
+{
+
+	if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE)
+		panic(\"%s: %p %d/%d is locked but should not be\",
+		str, vp, vp->v_tag, vp->v_type);
+}
+
+static inline void
+assert_vop_locked(vnode_t *vp, const char *str)
+{
+
+	if (VOP_ISLOCKED(vp) == LK_NONE)
+		panic(\"%s: %p %d/%d is not locked but should be\",
+		str, vp, vp->v_tag, vp->v_type);
+}
+
+static inline void
+assert_vop_elocked(vnode_t *vp, const char *str)
+{
+
+	if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE)
+		panic(\"%s: %p %d/%d is not exclusive locked but should be\",
+		str, vp, vp->v_tag, vp->v_type);
+}
+
 const struct vnodeop_desc vop_default_desc = {"
 echo '	0,
 	"default",
@@ -691,25 +721,16 @@ function bodynorm() {
 	printf("{\n\tint error;\n\tbool mpsafe;\n\tstruct %s_args a;\n",
 		args_name);
 	printf("\tstruct mount *mp;\n");
-	if (lockdebug) {
-		printf("#ifdef VNODE_LOCKDEBUG\n");
-		for (i=0; i
 effect:	Iff defined, build with -DLOCKDEBUG.
 
 
+RUMP_VNODE_LOCKDEBUG
+
+values:	 / 
+defval:	
+effect:	Iff defined, build with -DVNODE_LOCKDEBUG.
+
+
 RUMP_KTRACE
 
 values:	yes|no



CVS commit: src/sys

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 08:34:00 UTC 2022

Modified Files:
src/sys/kern: vnode_if.sh vnode_if.src
src/sys/rump: Makefile.rump README.compileopts

Log Message:
Make option VNODE_LOCKDEBUG more functional.

- Add "LOCKED=EXCL" option for vnode operations needing exclusive locked nodes.

- As it is impossible to check for shared locks held by current thread avoid
  false assertions by testing for exclusive lock only in the "LOCKED=NO" case.

- New option "RUMP_VNODE_LOCKDEBUG" enables VNODE_LOCKDEBUG for the rump kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/kern/vnode_if.sh
cvs rdiff -u -r1.83 -r1.84 src/sys/kern/vnode_if.src
cvs rdiff -u -r1.133 -r1.134 src/sys/rump/Makefile.rump
cvs rdiff -u -r1.14 -r1.15 src/sys/rump/README.compileopts

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



CVS commit: src/tests/rump/rumpvfs

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 07:36:20 UTC 2022

Modified Files:
src/tests/rump/rumpvfs: t_p2kifs.c

Log Message:
Lock vnode for VOP_LOOKUP().


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/rump/rumpvfs/t_p2kifs.c

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

Modified files:

Index: src/tests/rump/rumpvfs/t_p2kifs.c
diff -u src/tests/rump/rumpvfs/t_p2kifs.c:1.6 src/tests/rump/rumpvfs/t_p2kifs.c:1.7
--- src/tests/rump/rumpvfs/t_p2kifs.c:1.6	Fri Jan 13 21:30:43 2017
+++ src/tests/rump/rumpvfs/t_p2kifs.c	Tue May  3 07:36:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_p2kifs.c,v 1.6 2017/01/13 21:30:43 christos Exp $	*/
+/*	$NetBSD: t_p2kifs.c,v 1.7 2022/05/03 07:36:20 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -70,6 +70,9 @@ ATF_TC_BODY(makecn, tc)
 	/* need stable lwp for componentname */
 	RZ(rump_pub_lwproc_rfork(RUMP_RFCFDG));
 
+	/* obey vnode locking rules */
+	RZ(RUMP_VOP_LOCK(rumpns_rootvnode, RUMP_LK_EXCLUSIVE));
+
 	/* try it once with the right path */
 	cn = rump_pub_makecn(RUMP_NAMEI_LOOKUP, 0, pathstr, strlen(pathstr),
 	rump_pub_cred_create(0, 0, 0, NULL), rump_pub_lwproc_curlwp());
@@ -81,6 +84,8 @@ ATF_TC_BODY(makecn, tc)
 	rump_pub_cred_create(0, 0, 0, NULL), rump_pub_lwproc_curlwp());
 	strcpy(pathstr, "/muuta");
 	RZ(RUMP_VOP_LOOKUP(rumpns_rootvnode, , cn));
+
+	RZ(RUMP_VOP_UNLOCK(rumpns_rootvnode));
 	rump_pub_freecn(cn, RUMPCN_FREECRED);
 }
 



CVS commit: src/tests/rump/rumpvfs

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 07:36:20 UTC 2022

Modified Files:
src/tests/rump/rumpvfs: t_p2kifs.c

Log Message:
Lock vnode for VOP_LOOKUP().


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/rump/rumpvfs/t_p2kifs.c

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



CVS commit: src/sys/fs/udf

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 07:35:43 UTC 2022

Modified Files:
src/sys/fs/udf: udf_vnops.c

Log Message:
No IO_NODELOCKED for unlocked vnode.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/fs/udf/udf_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/fs/udf

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 07:35:43 UTC 2022

Modified Files:
src/sys/fs/udf: udf_vnops.c

Log Message:
No IO_NODELOCKED for unlocked vnode.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/fs/udf/udf_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/fs/udf/udf_vnops.c
diff -u src/sys/fs/udf/udf_vnops.c:1.123 src/sys/fs/udf/udf_vnops.c:1.124
--- src/sys/fs/udf/udf_vnops.c:1.123	Sun Apr 10 09:50:46 2022
+++ src/sys/fs/udf/udf_vnops.c	Tue May  3 07:35:43 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_vnops.c,v 1.123 2022/04/10 09:50:46 andvar Exp $ */
+/* $NetBSD: udf_vnops.c,v 1.124 2022/05/03 07:35:43 hannken Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -32,7 +32,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.123 2022/04/10 09:50:46 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.124 2022/05/03 07:35:43 hannken Exp $");
 #endif /* not lint */
 
 
@@ -1701,7 +1701,7 @@ udf_do_symlink(struct udf_node *udf_node
 	/* write out structure on the new file */
 	error = vn_rdwr(UIO_WRITE, udf_node->vnode,
 		pathbuf, pathlen, 0,
-		UIO_SYSSPACE, IO_NODELOCKED | IO_ALTSEMANTICS,
+		UIO_SYSSPACE, IO_ALTSEMANTICS,
 		FSCRED, NULL, NULL);
 
 	/* return status of symlink contents writeout */



CVS commit: src/sys/fs

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 07:34:38 UTC 2022

Modified Files:
src/sys/fs/sysvbfs: sysvbfs_vfsops.c
src/sys/fs/v7fs: v7fs_vfsops.c

Log Message:
Lock devvp for kauth KAUTH_REQ_SYSTEM_MOUNT_DEVICE.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/fs/sysvbfs/sysvbfs_vfsops.c
cvs rdiff -u -r1.18 -r1.19 src/sys/fs/v7fs/v7fs_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/fs/sysvbfs/sysvbfs_vfsops.c
diff -u src/sys/fs/sysvbfs/sysvbfs_vfsops.c:1.47 src/sys/fs/sysvbfs/sysvbfs_vfsops.c:1.48
--- src/sys/fs/sysvbfs/sysvbfs_vfsops.c:1.47	Fri Jan 17 20:08:08 2020
+++ src/sys/fs/sysvbfs/sysvbfs_vfsops.c	Tue May  3 07:34:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysvbfs_vfsops.c,v 1.47 2020/01/17 20:08:08 ad Exp $	*/
+/*	$NetBSD: sysvbfs_vfsops.c,v 1.48 2022/05/03 07:34:38 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vfsops.c,v 1.47 2020/01/17 20:08:08 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vfsops.c,v 1.48 2022/05/03 07:34:38 hannken Exp $");
 
 #include 
 #include 
@@ -139,9 +139,11 @@ sysvbfs_mount(struct mount *mp, const ch
 		(mp->mnt_flag & MNT_RDONLY) == 0)
 			accessmode |= VWRITE;
 
+		vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
 		error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_MOUNT,
 		KAUTH_REQ_SYSTEM_MOUNT_DEVICE, mp, devvp,
 		KAUTH_ARG(accessmode));
+		VOP_UNLOCK(devvp);
 	}
 
 	if (error) {

Index: src/sys/fs/v7fs/v7fs_vfsops.c
diff -u src/sys/fs/v7fs/v7fs_vfsops.c:1.18 src/sys/fs/v7fs/v7fs_vfsops.c:1.19
--- src/sys/fs/v7fs/v7fs_vfsops.c:1.18	Sat Feb  5 14:11:52 2022
+++ src/sys/fs/v7fs/v7fs_vfsops.c	Tue May  3 07:34:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_vfsops.c,v 1.18 2022/02/05 14:11:52 zafer Exp $	*/
+/*	$NetBSD: v7fs_vfsops.c,v 1.19 2022/05/03 07:34:38 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: v7fs_vfsops.c,v 1.18 2022/02/05 14:11:52 zafer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: v7fs_vfsops.c,v 1.19 2022/05/03 07:34:38 hannken Exp $");
 #if defined _KERNEL_OPT
 #include "opt_v7fs.h"
 #endif
@@ -157,9 +157,12 @@ v7fs_mount(struct mount *mp, const char 
 		(mp->mnt_iflag & IMNT_WANTRDWR) != 0 :
 		(mp->mnt_flag & MNT_RDONLY) == 0)
 			accessmode |= VWRITE;
+
+		vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
 		error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_MOUNT,
 		KAUTH_REQ_SYSTEM_MOUNT_DEVICE, mp, devvp,
 		KAUTH_ARG(accessmode));
+		VOP_UNLOCK(devvp);
 	}
 
 	if (error) {



CVS commit: src/sys/fs

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 07:34:38 UTC 2022

Modified Files:
src/sys/fs/sysvbfs: sysvbfs_vfsops.c
src/sys/fs/v7fs: v7fs_vfsops.c

Log Message:
Lock devvp for kauth KAUTH_REQ_SYSTEM_MOUNT_DEVICE.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/fs/sysvbfs/sysvbfs_vfsops.c
cvs rdiff -u -r1.18 -r1.19 src/sys/fs/v7fs/v7fs_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/fs

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 07:33:07 UTC 2022

Modified Files:
src/sys/fs/cd9660: cd9660_vfsops.c
src/sys/fs/udf: udf_vfsops.c

Log Message:
Lock devvp for vinvalbuf().


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/fs/cd9660/cd9660_vfsops.c
cvs rdiff -u -r1.84 -r1.85 src/sys/fs/udf/udf_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/fs/cd9660/cd9660_vfsops.c
diff -u src/sys/fs/cd9660/cd9660_vfsops.c:1.96 src/sys/fs/cd9660/cd9660_vfsops.c:1.97
--- src/sys/fs/cd9660/cd9660_vfsops.c:1.96	Sat Apr  4 20:49:30 2020
+++ src/sys/fs/cd9660/cd9660_vfsops.c	Tue May  3 07:33:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660_vfsops.c,v 1.96 2020/04/04 20:49:30 ad Exp $	*/
+/*	$NetBSD: cd9660_vfsops.c,v 1.97 2022/05/03 07:33:07 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1994
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.96 2020/04/04 20:49:30 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.97 2022/05/03 07:33:07 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -358,7 +358,10 @@ iso_mountfs(struct vnode *devvp, struct 
 		return EROFS;
 
 	/* Flush out any old buffers remaining from a previous use. */
-	if ((error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0)) != 0)
+	vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
+	error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0);
+	VOP_UNLOCK(devvp);
+	if (error != 0)
 		return (error);
 
 	/* This is the "logical sector size".  The standard says this

Index: src/sys/fs/udf/udf_vfsops.c
diff -u src/sys/fs/udf/udf_vfsops.c:1.84 src/sys/fs/udf/udf_vfsops.c:1.85
--- src/sys/fs/udf/udf_vfsops.c:1.84	Wed Mar 23 13:06:06 2022
+++ src/sys/fs/udf/udf_vfsops.c	Tue May  3 07:33:07 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_vfsops.c,v 1.84 2022/03/23 13:06:06 andvar Exp $ */
+/* $NetBSD: udf_vfsops.c,v 1.85 2022/05/03 07:33:07 hannken Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_vfsops.c,v 1.84 2022/03/23 13:06:06 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_vfsops.c,v 1.85 2022/05/03 07:33:07 hannken Exp $");
 #endif /* not lint */
 
 
@@ -574,7 +574,10 @@ udf_mountfs(struct vnode *devvp, struct 
 	intnum_anchors, error;
 
 	/* flush out any old buffers remaining from a previous use. */
-	if ((error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0)))
+	vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
+	error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0);
+	VOP_UNLOCK(devvp);
+	if (error)
 		return error;
 
 	/* setup basic mount information */



CVS commit: src/sys/fs

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 07:33:07 UTC 2022

Modified Files:
src/sys/fs/cd9660: cd9660_vfsops.c
src/sys/fs/udf: udf_vfsops.c

Log Message:
Lock devvp for vinvalbuf().


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/fs/cd9660/cd9660_vfsops.c
cvs rdiff -u -r1.84 -r1.85 src/sys/fs/udf/udf_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/nfs

2022-04-27 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Apr 27 17:38:52 UTC 2022

Modified Files:
src/sys/nfs: nfs_serv.c nfs_srvsubs.c nfs_var.h

Log Message:
As VOP_GETATTR() needs a shared lock at least move the preopattr lookup
inside nfs_namei() where we may lock the start directory without violating
the lock order.


To generate a diff of this commit:
cvs rdiff -u -r1.182 -r1.183 src/sys/nfs/nfs_serv.c
cvs rdiff -u -r1.15 -r1.16 src/sys/nfs/nfs_srvsubs.c
cvs rdiff -u -r1.95 -r1.96 src/sys/nfs/nfs_var.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/nfs/nfs_serv.c
diff -u src/sys/nfs/nfs_serv.c:1.182 src/sys/nfs/nfs_serv.c:1.183
--- src/sys/nfs/nfs_serv.c:1.182	Thu Sep 16 20:17:47 2021
+++ src/sys/nfs/nfs_serv.c	Wed Apr 27 17:38:52 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_serv.c,v 1.182 2021/09/16 20:17:47 andvar Exp $	*/
+/*	$NetBSD: nfs_serv.c,v 1.183 2022/04/27 17:38:52 hannken Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -55,7 +55,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.182 2021/09/16 20:17:47 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.183 2022/04/27 17:38:52 hannken Exp $");
 
 #include 
 #include 
@@ -422,7 +422,8 @@ nfsrv_lookup(struct nfsrv_descript *nfsd
 	nd.ni_cnd.cn_nameiop = LOOKUP;
 	nd.ni_cnd.cn_flags = LOCKLEAF;
 	error = nfs_namei(, , len, slp, nam, , ,
-		, lwp, (nfsd->nd_flag & ND_KERBAUTH), pubflag);
+		, NULL, NULL,
+		lwp, (nfsd->nd_flag & ND_KERBAUTH), pubflag);
 
 	if (!error && pubflag) {
 		if (nd.ni_vp->v_type == VDIR && nfs_pub.np_index != NULL &&
@@ -1447,10 +1448,8 @@ nfsrv_create(struct nfsrv_descript *nfsd
 	nd.ni_cnd.cn_nameiop = CREATE;
 	nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF;
 	error = nfs_namei(, , len, slp, nam, , ,
-		, lwp, (nfsd->nd_flag & ND_KERBAUTH), false);
-	if (dirp && v3) {
-		dirfor_ret = VOP_GETATTR(dirp, , cred);
-	}
+		, (v3 ? _ret : NULL), ,
+		lwp, (nfsd->nd_flag & ND_KERBAUTH), false);
 	if (error) {
 		nfsm_reply(NFSX_WCCDATA(v3));
 		nfsm_srvwcc_data(dirfor_ret, , diraft_ret, );
@@ -1689,9 +1688,8 @@ nfsrv_mknod(struct nfsrv_descript *nfsd,
 	nd.ni_cnd.cn_nameiop = CREATE;
 	nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF;
 	error = nfs_namei(, , len, slp, nam, , ,
-		, lwp, (nfsd->nd_flag & ND_KERBAUTH), false);
-	if (dirp)
-		dirfor_ret = VOP_GETATTR(dirp, , cred);
+		, _ret, ,
+		lwp, (nfsd->nd_flag & ND_KERBAUTH), false);
 	if (error) {
 		nfsm_reply(NFSX_WCCDATA(1));
 		nfsm_srvwcc_data(dirfor_ret, , diraft_ret, );
@@ -1845,14 +1843,8 @@ nfsrv_remove(struct nfsrv_descript *nfsd
 	nd.ni_cnd.cn_nameiop = DELETE;
 	nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF;
 	error = nfs_namei(, , len, slp, nam, , ,
-		, lwp, (nfsd->nd_flag & ND_KERBAUTH), false);
-	if (error == 0 && dirp && v3) {
-		if (nd.ni_dvp == nd.ni_vp)
-			vn_lock(dirp, LK_SHARED | LK_RETRY);
-		dirfor_ret = VOP_GETATTR(dirp, , cred);
-		if (nd.ni_dvp == nd.ni_vp)
-			VOP_UNLOCK(dirp);
-	}
+		, (v3 ? _ret : NULL), ,
+		lwp, (nfsd->nd_flag & ND_KERBAUTH), false);
 	if (!error) {
 		vp = nd.ni_vp;
 		if (vp->v_type == VDIR) {
@@ -1944,14 +1936,8 @@ nfsrv_rename(struct nfsrv_descript *nfsd
 	fromnd.ni_cnd.cn_nameiop = DELETE;
 	fromnd.ni_cnd.cn_flags = LOCKPARENT;
 	error = nfs_namei(, , len, slp, nam, ,
-		, , lwp, (nfsd->nd_flag & ND_KERBAUTH), false);
-	if (error == 0 && fdirp && v3) {
-		if (fromnd.ni_dvp == fromnd.ni_vp)
-			vn_lock(fdirp, LK_SHARED | LK_RETRY);
-		fdirfor_ret = VOP_GETATTR(fdirp, , cred);
-		if (fromnd.ni_dvp == fromnd.ni_vp)
-			VOP_UNLOCK(fdirp);
-	}
+		, , (v3 ? _ret : NULL), ,
+		lwp, (nfsd->nd_flag & ND_KERBAUTH), false);
 	if (error) {
 		fromnd.ni_cnd.cn_nameiop = 0;
 		nfsm_reply(2 * NFSX_WCCDATA(v3));
@@ -2021,10 +2007,8 @@ nfsrv_rename(struct nfsrv_descript *nfsd
 	tond.ni_cnd.cn_nameiop = RENAME;
 	tond.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | NOCACHE;
 	error = nfs_namei(, , len2, slp, nam, ,
-		, , lwp, (nfsd->nd_flag & ND_KERBAUTH), false);
-	if (tdirp && v3) {
-		tdirfor_ret = VOP_GETATTR(tdirp, , cred);
-	}
+		, , (v3 ? _ret : NULL), ,
+		lwp, (nfsd->nd_flag & ND_KERBAUTH), false);
 	if (error) {
 		VFS_RENAMELOCK_EXIT(localfs);
 		VOP_ABORTOP(fromnd.ni_dvp, _cnd);
@@ -2218,10 +2202,8 @@ nfsrv_link(struct nfsrv_descript *nfsd, 
 	nd.ni_cnd.cn_nameiop = CREATE;
 	nd.ni_cnd.cn_flags = LOCKPARENT;
 	error = nfs_namei(, , len, slp, nam, , ,
-		, lwp, (nfsd->nd_flag & ND_KERBAUTH), false);
-	if (dirp && v3) {
-		dirfor_ret = VOP_GETATTR(dirp, , cred);
-	}
+		, (v3 ? _ret : NULL), ,
+		lwp, (nfsd->nd_flag & ND_KERBAUTH), false);
 	if (error)
 		goto out1;
 	xp = nd.ni_vp;
@@ -2310,10 +2292,8 @@ nfsrv_symlink(struct nfsrv_descript *nfs
 	nd.ni_cnd.cn_nameiop = CREATE;
 	nd.ni_cnd.cn_flags = LOCKPARENT;
 	error = nfs_namei(, , len, slp, nam, , ,
-		, lwp, (nfsd->nd_flag & ND_KERBAUTH), false);
-	if (dirp && v3) {
-		dirfor_ret = VOP_GETATTR(dirp, , cred);
-	}
+		, (v3 ? _ret : NULL), ,
+		lwp, 

CVS commit: src/sys/nfs

2022-04-27 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Apr 27 17:38:52 UTC 2022

Modified Files:
src/sys/nfs: nfs_serv.c nfs_srvsubs.c nfs_var.h

Log Message:
As VOP_GETATTR() needs a shared lock at least move the preopattr lookup
inside nfs_namei() where we may lock the start directory without violating
the lock order.


To generate a diff of this commit:
cvs rdiff -u -r1.182 -r1.183 src/sys/nfs/nfs_serv.c
cvs rdiff -u -r1.15 -r1.16 src/sys/nfs/nfs_srvsubs.c
cvs rdiff -u -r1.95 -r1.96 src/sys/nfs/nfs_var.h

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



CVS commit: src/usr.sbin/quotaon

2022-04-26 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Apr 26 15:39:00 UTC 2022

Modified Files:
src/usr.sbin/quotaon: quotaon.c

Log Message:
As the quota type comes from the kernel and is only valid when
quota is on get the type before quota_off and after quota_on.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/quotaon/quotaon.c

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

Modified files:

Index: src/usr.sbin/quotaon/quotaon.c
diff -u src/usr.sbin/quotaon/quotaon.c:1.30 src/usr.sbin/quotaon/quotaon.c:1.31
--- src/usr.sbin/quotaon/quotaon.c:1.30	Sat Apr  7 05:07:33 2012
+++ src/usr.sbin/quotaon/quotaon.c	Tue Apr 26 15:39:00 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotaon.c,v 1.30 2012/04/07 05:07:33 christos Exp $	*/
+/*	$NetBSD: quotaon.c,v 1.31 2022/04/26 15:39:00 hannken Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)quotaon.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: quotaon.c,v 1.30 2012/04/07 05:07:33 christos Exp $");
+__RCSID("$NetBSD: quotaon.c,v 1.31 2022/04/26 15:39:00 hannken Exp $");
 #endif
 #endif /* not lint */
 
@@ -217,12 +217,14 @@ quotaonoff(struct fstab *fs, struct quot
 int warn_on_enxio, const char *fsspec)
 {
 	const char *mode = (offmode == 1) ? "off" : "on";
+	const char *type;
 
 	if (strcmp(fs->fs_file, "/") && readonly(fs, fsspec)) {
 		return 1;
 	}
 
 	if (offmode) {
+		type = quota_idtype_getname(qh, idtype);
 		if (quota_quotaoff(qh, idtype)) {
 			if (warn_on_enxio || errno != ENXIO) {
 warn("quota%s for %s", mode, fs->fs_file);
@@ -236,11 +238,12 @@ quotaonoff(struct fstab *fs, struct quot
 			}
 			return 1;
 		}
+		type = quota_idtype_getname(qh, idtype);
 	}
 
 	if (vflag) {
 		printf("%s: %s quotas turned %s\n",
-		fs->fs_file, quota_idtype_getname(qh, idtype), mode);
+		fs->fs_file, type, mode);
 	}
 	return 0;
 }



CVS commit: src/usr.sbin/quotaon

2022-04-26 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Apr 26 15:39:00 UTC 2022

Modified Files:
src/usr.sbin/quotaon: quotaon.c

Log Message:
As the quota type comes from the kernel and is only valid when
quota is on get the type before quota_off and after quota_on.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/quotaon/quotaon.c

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



CVS commit: src/sys/ufs/ufs

2022-04-26 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Apr 26 15:37:25 UTC 2022

Modified Files:
src/sys/ufs/ufs: ufs_quota1.c

Log Message:
Keep flag "UFS_QUOTA" set until the last quota is closed.

Prevents a live lock when dqrele() finds a struct with "dq_cnt == 1"
and flag "DQ_MOD" and cannot sync as flag UFS_QUOTA is unset.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/ufs/ufs/ufs_quota1.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/ufs/ufs/ufs_quota1.c
diff -u src/sys/ufs/ufs/ufs_quota1.c:1.24 src/sys/ufs/ufs/ufs_quota1.c:1.25
--- src/sys/ufs/ufs/ufs_quota1.c:1.24	Tue Jun 29 22:40:54 2021
+++ src/sys/ufs/ufs/ufs_quota1.c	Tue Apr 26 15:37:25 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota1.c,v 1.24 2021/06/29 22:40:54 dholland Exp $	*/
+/*	$NetBSD: ufs_quota1.c,v 1.25 2022/04/26 15:37:25 hannken Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_quota1.c,v 1.24 2021/06/29 22:40:54 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota1.c,v 1.25 2022/04/26 15:37:25 hannken Exp $");
 
 #include 
 #include 
@@ -433,7 +433,6 @@ quota1_handle_cmd_quotaoff(struct lwp *l
 		return (0);
 	}
 	ump->umq1_qflags[type] |= QTF_CLOSING;
-	ump->um_flags &= ~UFS_QUOTA;
 	mutex_exit();
 	/*
 	 * Search vnodes associated with this mount point,
@@ -470,6 +469,8 @@ quota1_handle_cmd_quotaoff(struct lwp *l
 		if (ump->um_quotas[i] != NULLVP)
 			break;
 	ump->umq1_qflags[type] &= ~QTF_CLOSING;
+	if (i == MAXQUOTAS)
+		ump->um_flags &= ~UFS_QUOTA;
 	cv_broadcast();
 	mutex_exit();
 	kauth_cred_free(cred);



CVS commit: src/sys/ufs/ufs

2022-04-26 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Apr 26 15:37:25 UTC 2022

Modified Files:
src/sys/ufs/ufs: ufs_quota1.c

Log Message:
Keep flag "UFS_QUOTA" set until the last quota is closed.

Prevents a live lock when dqrele() finds a struct with "dq_cnt == 1"
and flag "DQ_MOD" and cannot sync as flag UFS_QUOTA is unset.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/ufs/ufs/ufs_quota1.c

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



CVS commit: src/lib/libquota

2022-04-26 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Apr 26 15:36:42 UTC 2022

Modified Files:
src/lib/libquota: quota_oldfiles.c

Log Message:
Fix default quota file names, both user and group quota used the
same default name "QUOTAFILENAME, names[USRQUOTA])" resulting in
diagnostic assertion and possibly corrupted quota data.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libquota/quota_oldfiles.c

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

Modified files:

Index: src/lib/libquota/quota_oldfiles.c
diff -u src/lib/libquota/quota_oldfiles.c:1.9 src/lib/libquota/quota_oldfiles.c:1.10
--- src/lib/libquota/quota_oldfiles.c:1.9	Fri Feb 24 18:00:09 2012
+++ src/lib/libquota/quota_oldfiles.c	Tue Apr 26 15:36:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: quota_oldfiles.c,v 1.9 2012/02/24 18:00:09 njoly Exp $	*/
+/*	$NetBSD: quota_oldfiles.c,v 1.10 2022/04/26 15:36:42 hannken Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -33,7 +33,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: quota_oldfiles.c,v 1.9 2012/02/24 18:00:09 njoly Exp $");
+__RCSID("$NetBSD: quota_oldfiles.c,v 1.10 2022/04/26 15:36:42 hannken Exp $");
 
 #include 
 #include 
@@ -255,7 +255,7 @@ __quota_oldfiles_defquotafile(struct quo
 
 	(void)snprintf(buf, maxlen, "%s/%s.%s",
 		   qh->qh_mountpoint,
-		   QUOTAFILENAME, names[USRQUOTA]);
+		   QUOTAFILENAME, names[idtype]);
 }
 
 const char *



CVS commit: src/lib/libquota

2022-04-26 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Apr 26 15:36:42 UTC 2022

Modified Files:
src/lib/libquota: quota_oldfiles.c

Log Message:
Fix default quota file names, both user and group quota used the
same default name "QUOTAFILENAME, names[USRQUOTA])" resulting in
diagnostic assertion and possibly corrupted quota data.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libquota/quota_oldfiles.c

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



CVS commit: src/sbin/fsck_msdos

2022-04-24 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun Apr 24 10:35:15 UTC 2022

Modified Files:
src/sbin/fsck_msdos: boot.c

Log Message:
Cast read()/write() result to size_t to make this compile again.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sbin/fsck_msdos/boot.c

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

Modified files:

Index: src/sbin/fsck_msdos/boot.c
diff -u src/sbin/fsck_msdos/boot.c:1.24 src/sbin/fsck_msdos/boot.c:1.25
--- src/sbin/fsck_msdos/boot.c:1.24	Sat Apr 23 22:40:28 2022
+++ src/sbin/fsck_msdos/boot.c	Sun Apr 24 10:35:15 2022
@@ -27,7 +27,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: boot.c,v 1.24 2022/04/23 22:40:28 mlelstv Exp $");
+__RCSID("$NetBSD: boot.c,v 1.25 2022/04/24 10:35:15 hannken Exp $");
 #endif /* not lint */
 
 #include 
@@ -132,7 +132,8 @@ readboot(int dosfs, struct bootblock *bo
 
 		if (lseek(dosfs, boot->FSInfo * boot->BytesPerSec, SEEK_SET)
 		!= boot->FSInfo * boot->BytesPerSec
-		|| read(dosfs, fsinfo, 2 * secsize) != 2 * secsize) {
+		|| (size_t)read(dosfs, fsinfo, 2 * secsize)
+		!= 2 * secsize) {
 			perr("could not read fsinfo block");
 			return FSFATAL;
 		}
@@ -181,7 +182,7 @@ readboot(int dosfs, struct bootblock *bo
 
 		if (lseek(dosfs, boot->Backup * boot->BytesPerSec, SEEK_SET)
 		!= boot->Backup * boot->BytesPerSec
-		|| read(dosfs, backup, secsize) != secsize) {
+		|| (size_t)read(dosfs, backup, secsize) != secsize) {
 			perr("could not read backup bootblock");
 			free(fsinfo);
 			free(backup);
@@ -307,7 +308,8 @@ writefsinfo(int dosfs, struct bootblock 
 
 	if (lseek(dosfs, boot->FSInfo * boot->BytesPerSec, SEEK_SET)
 	!= boot->FSInfo * boot->BytesPerSec
-	|| read(dosfs, fsinfo, 2 * boot->BytesPerSec) != 2 * boot->BytesPerSec) {
+	|| (size_t)read(dosfs, fsinfo, 2 * boot->BytesPerSec)
+	!= 2 * boot->BytesPerSec) {
 		perr("could not read fsinfo block");
 		free(fsinfo);
 		return FSFATAL;
@@ -322,7 +324,8 @@ writefsinfo(int dosfs, struct bootblock 
 	fsinfo[0x1ef] = (u_char)(boot->FSNext >> 24);
 	if (lseek(dosfs, boot->FSInfo * boot->BytesPerSec, SEEK_SET)
 	!= boot->FSInfo * boot->BytesPerSec
-	|| write(dosfs, fsinfo, 2 * boot->BytesPerSec) != 2 * boot->BytesPerSec) {
+	|| (size_t)write(dosfs, fsinfo, 2 * boot->BytesPerSec)
+	!= 2 * boot->BytesPerSec) {
 		perr("Unable to write FSInfo");
 		free(fsinfo);
 		return FSFATAL;



CVS commit: src/sbin/fsck_msdos

2022-04-24 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun Apr 24 10:35:15 UTC 2022

Modified Files:
src/sbin/fsck_msdos: boot.c

Log Message:
Cast read()/write() result to size_t to make this compile again.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sbin/fsck_msdos/boot.c

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



CVS commit: src/sys/dev/usb

2022-04-24 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun Apr 24 09:55:48 UTC 2022

Modified Files:
src/sys/dev/usb: uvideo.c

Log Message:
Add missing argument to debug printf.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/usb/uvideo.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/dev/usb/uvideo.c
diff -u src/sys/dev/usb/uvideo.c:1.78 src/sys/dev/usb/uvideo.c:1.79
--- src/sys/dev/usb/uvideo.c:1.78	Sun Apr 17 13:17:30 2022
+++ src/sys/dev/usb/uvideo.c	Sun Apr 24 09:55:48 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvideo.c,v 1.78 2022/04/17 13:17:30 riastradh Exp $	*/
+/*	$NetBSD: uvideo.c,v 1.79 2022/04/24 09:55:48 hannken Exp $	*/
 
 /*
  * Copyright (c) 2008 Patrick Mahoney
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.78 2022/04/17 13:17:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.79 2022/04/24 09:55:48 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1422,6 +1422,7 @@ uvideo_stream_init_frame_based_format(st
 			DPRINTF(("uvideo:"
 " truncated CS subtype-0x%x descriptor,"
 " length %d < %d",
+uvdesc->bDescriptorSubtype,
 uvdesc->bLength, subtypelen));
 			break;
 		}



CVS commit: src/sys/dev/usb

2022-04-24 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun Apr 24 09:55:48 UTC 2022

Modified Files:
src/sys/dev/usb: uvideo.c

Log Message:
Add missing argument to debug printf.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/usb/uvideo.c

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



CVS commit: src/sys

2022-04-23 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 23 16:22:23 UTC 2022

Modified Files:
src/sys/dev/dkwedge: dk.c
src/sys/ufs/ffs: ffs_alloc.c

Log Message:
Need vnode locked fot VOP_FDISCARD().


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/dkwedge/dk.c
cvs rdiff -u -r1.170 -r1.171 src/sys/ufs/ffs/ffs_alloc.c

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



CVS commit: src/sys

2022-04-23 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 23 16:22:23 UTC 2022

Modified Files:
src/sys/dev/dkwedge: dk.c
src/sys/ufs/ffs: ffs_alloc.c

Log Message:
Need vnode locked fot VOP_FDISCARD().


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/dkwedge/dk.c
cvs rdiff -u -r1.170 -r1.171 src/sys/ufs/ffs/ffs_alloc.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/dev/dkwedge/dk.c
diff -u src/sys/dev/dkwedge/dk.c:1.110 src/sys/dev/dkwedge/dk.c:1.111
--- src/sys/dev/dkwedge/dk.c:1.110	Sat Jan 15 19:34:11 2022
+++ src/sys/dev/dkwedge/dk.c	Sat Apr 23 16:22:23 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: dk.c,v 1.110 2022/01/15 19:34:11 riastradh Exp $	*/
+/*	$NetBSD: dk.c,v 1.111 2022/04/23 16:22:23 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.110 2022/01/15 19:34:11 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.111 2022/04/23 16:22:23 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -1592,6 +1592,7 @@ dkdiscard(dev_t dev, off_t pos, off_t le
 	struct dkwedge_softc *sc = dkwedge_lookup(dev);
 	unsigned shift;
 	off_t offset, maxlen;
+	int error;
 
 	if (sc == NULL)
 		return (ENODEV);
@@ -1615,7 +1616,12 @@ dkdiscard(dev_t dev, off_t pos, off_t le
 		return (EINVAL);
 
 	pos += offset;
-	return VOP_FDISCARD(sc->sc_parent->dk_rawvp, pos, len);
+
+	vn_lock(sc->sc_parent->dk_rawvp, LK_EXCLUSIVE | LK_RETRY);
+	error = VOP_FDISCARD(sc->sc_parent->dk_rawvp, pos, len);
+	VOP_UNLOCK(sc->sc_parent->dk_rawvp);
+
+	return error;
 }
 
 /*

Index: src/sys/ufs/ffs/ffs_alloc.c
diff -u src/sys/ufs/ffs/ffs_alloc.c:1.170 src/sys/ufs/ffs/ffs_alloc.c:1.171
--- src/sys/ufs/ffs/ffs_alloc.c:1.170	Fri Sep  3 21:55:01 2021
+++ src/sys/ufs/ffs/ffs_alloc.c	Sat Apr 23 16:22:23 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_alloc.c,v 1.170 2021/09/03 21:55:01 andvar Exp $	*/
+/*	$NetBSD: ffs_alloc.c,v 1.171 2022/04/23 16:22:23 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.170 2021/09/03 21:55:01 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.171 2022/04/23 16:22:23 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1649,10 +1649,12 @@ ffs_discardcb(struct work *wk, void *arg
 
 	start = FFS_FSBTOBYTES(fs, td->bno);
 	len = td->size;
+	vn_lock(td->devvp, LK_EXCLUSIVE | LK_RETRY);
 #ifdef TRIMDEBUG
 	error =
 #endif
 		VOP_FDISCARD(td->devvp, start, len);
+	VOP_UNLOCK(td->devvp);
 #ifdef TRIMDEBUG
 	printf("trim(%" PRId64 ",%ld):%d\n", td->bno, td->size, error);
 #endif



CVS commit: src/sys/ufs/ffs

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 08:00:55 UTC 2022

Modified Files:
src/sys/ufs/ffs: ffs_vfsops.c

Log Message:
Unlock vnode for VOP_IOCTL() and wapbl_flush().


To generate a diff of this commit:
cvs rdiff -u -r1.375 -r1.376 src/sys/ufs/ffs/ffs_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/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.375 src/sys/ufs/ffs/ffs_vfsops.c:1.376
--- src/sys/ufs/ffs/ffs_vfsops.c:1.375	Sat Mar 19 13:53:33 2022
+++ src/sys/ufs/ffs/ffs_vfsops.c	Sat Apr 16 08:00:55 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vfsops.c,v 1.375 2022/03/19 13:53:33 hannken Exp $	*/
+/*	$NetBSD: ffs_vfsops.c,v 1.376 2022/04/16 08:00:55 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.375 2022/03/19 13:53:33 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.376 2022/04/16 08:00:55 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -2480,7 +2480,9 @@ ffs_vfs_fsync(vnode_t *vp, int flags)
 		 * contains no dirty buffers that could be in the log.
 		 */
 		if (!LIST_EMPTY(>v_dirtyblkhd)) {
+			VOP_UNLOCK(vp);
 			error = wapbl_flush(mp->mnt_wapbl, 0);
+			vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 			if (error)
 return error;
 		}
@@ -2499,8 +2501,10 @@ ffs_vfs_fsync(vnode_t *vp, int flags)
 	error = vflushbuf(vp, flags);
 	if (error == 0 && (flags & FSYNC_CACHE) != 0) {
 		i = 1;
+		VOP_UNLOCK(vp);
 		(void)VOP_IOCTL(vp, DIOCCACHESYNC, , FWRITE,
 		kauth_cred_get());
+		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	}
 
 	return error;



CVS commit: src/sys/ufs/ffs

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 08:00:55 UTC 2022

Modified Files:
src/sys/ufs/ffs: ffs_vfsops.c

Log Message:
Unlock vnode for VOP_IOCTL() and wapbl_flush().


To generate a diff of this commit:
cvs rdiff -u -r1.375 -r1.376 src/sys/ufs/ffs/ffs_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/ufs/ffs

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:59:46 UTC 2022

Modified Files:
src/sys/ufs/ffs: ffs_snapshot.c

Log Message:
Take the link count from the inode.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/ufs/ffs/ffs_snapshot.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/ufs/ffs/ffs_snapshot.c
diff -u src/sys/ufs/ffs/ffs_snapshot.c:1.153 src/sys/ufs/ffs/ffs_snapshot.c:1.154
--- src/sys/ufs/ffs/ffs_snapshot.c:1.153	Sun Dec  5 07:51:26 2021
+++ src/sys/ufs/ffs/ffs_snapshot.c	Sat Apr 16 07:59:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_snapshot.c,v 1.153 2021/12/05 07:51:26 msaitoh Exp $	*/
+/*	$NetBSD: ffs_snapshot.c,v 1.154 2022/04/16 07:59:46 hannken Exp $	*/
 
 /*
  * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.153 2021/12/05 07:51:26 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.154 2022/04/16 07:59:46 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -613,7 +613,6 @@ snapshot_copyfs(struct mount *mp, struct
 
 struct snapshot_expunge_ctx {
 	struct vnode *logvp;
-	struct lwp *l;
 	struct vnode *vp;
 	struct fs *copy_fs;
 };
@@ -621,7 +620,6 @@ struct snapshot_expunge_ctx {
 static bool
 snapshot_expunge_selector(void *cl, struct vnode *xvp)
 {
-	struct vattr vat;
 	struct snapshot_expunge_ctx *c = cl;
 	struct inode *xp;
 
@@ -639,8 +637,7 @@ snapshot_expunge_selector(void *cl, stru
 	if (xvp == c->logvp)
 		return true;
 
-	if (VOP_GETATTR(xvp, , c->l->l_cred) == 0 &&
-	vat.va_nlink > 0)
+	if (xp->i_nlink > 0)
 		return false;
 
 	if (ffs_checkfreefile(c->copy_fs, c->vp, xp->i_number))
@@ -664,7 +661,6 @@ snapshot_expunge(struct mount *mp, struc
 	daddr_t blkno, *blkp;
 	struct fs *fs = VFSTOUFS(mp)->um_fs;
 	struct inode *xp;
-	struct lwp *l = curlwp;
 	struct vnode *logvp = NULL, *xvp;
 	struct vnode_iterator *marker;
 	struct snapshot_expunge_ctx ctx;
@@ -688,7 +684,6 @@ snapshot_expunge(struct mount *mp, struc
 
 	vfs_vnode_iterator_init(mp, );
 	ctx.logvp = logvp;
-	ctx.l = l;
 	ctx.vp = vp;
 	ctx.copy_fs = copy_fs;
 	while ((xvp = vfs_vnode_iterator_next(marker, snapshot_expunge_selector,



CVS commit: src/sys/ufs/ffs

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:59:46 UTC 2022

Modified Files:
src/sys/ufs/ffs: ffs_snapshot.c

Log Message:
Take the link count from the inode.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/ufs/ffs/ffs_snapshot.c

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



CVS commit: src/sys/kern

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:59:02 UTC 2022

Modified Files:
src/sys/kern: sys_descrip.c

Log Message:
Lock vnode for VOP_PATHCONF().


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/kern/sys_descrip.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/kern/sys_descrip.c
diff -u src/sys/kern/sys_descrip.c:1.39 src/sys/kern/sys_descrip.c:1.40
--- src/sys/kern/sys_descrip.c:1.39	Tue Mar 15 10:37:42 2022
+++ src/sys/kern/sys_descrip.c	Sat Apr 16 07:59:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_descrip.c,v 1.39 2022/03/15 10:37:42 riastradh Exp $	*/
+/*	$NetBSD: sys_descrip.c,v 1.40 2022/04/16 07:59:02 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_descrip.c,v 1.39 2022/03/15 10:37:42 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_descrip.c,v 1.40 2022/04/16 07:59:02 hannken Exp $");
 
 #include 
 #include 
@@ -595,7 +595,9 @@ sys_fpathconf(struct lwp *l, const struc
 		break;
 
 	case DTYPE_VNODE:
+		vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY);
 		error = VOP_PATHCONF(fp->f_vnode, SCARG(uap, name), retval);
+		VOP_UNLOCK(fp->f_vnode);
 		break;
 
 	case DTYPE_KQUEUE:



CVS commit: src/sys/kern

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:59:02 UTC 2022

Modified Files:
src/sys/kern: sys_descrip.c

Log Message:
Lock vnode for VOP_PATHCONF().


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/kern/sys_descrip.c

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



CVS commit: src/sys/fs/msdosfs

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:58:21 UTC 2022

Modified Files:
src/sys/fs/msdosfs: msdosfs_vfsops.c

Log Message:
Lock vnode for vinvalbuf().


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/fs/msdosfs/msdosfs_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/fs/msdosfs/msdosfs_vfsops.c
diff -u src/sys/fs/msdosfs/msdosfs_vfsops.c:1.137 src/sys/fs/msdosfs/msdosfs_vfsops.c:1.138
--- src/sys/fs/msdosfs/msdosfs_vfsops.c:1.137	Sat Oct 23 16:58:17 2021
+++ src/sys/fs/msdosfs/msdosfs_vfsops.c	Sat Apr 16 07:58:21 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vfsops.c,v 1.137 2021/10/23 16:58:17 thorpej Exp $	*/
+/*	$NetBSD: msdosfs_vfsops.c,v 1.138 2022/04/16 07:58:21 hannken Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.137 2021/10/23 16:58:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.138 2022/04/16 07:58:21 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -472,7 +472,10 @@ msdosfs_mountfs(struct vnode *devvp, str
 	u_long fatbytes, fatblocksecs;
 
 	/* Flush out any old buffers remaining from a previous use. */
-	if ((error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0)) != 0)
+	vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
+	error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0);
+	VOP_UNLOCK(devvp);
+	if (error)
 		return (error);
 
 	ronly = (mp->mnt_flag & MNT_RDONLY) != 0;



CVS commit: src/sys/fs/msdosfs

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:58:21 UTC 2022

Modified Files:
src/sys/fs/msdosfs: msdosfs_vfsops.c

Log Message:
Lock vnode for vinvalbuf().


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/fs/msdosfs/msdosfs_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/dev/raidframe

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:57:33 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Unlock vnode for VOP_IOCTL().


To generate a diff of this commit:
cvs rdiff -u -r1.405 -r1.406 src/sys/dev/raidframe/rf_netbsdkintf.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/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.405 src/sys/dev/raidframe/rf_netbsdkintf.c:1.406
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.405	Mon Mar 28 13:07:14 2022
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Sat Apr 16 07:57:33 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.405 2022/03/28 13:07:14 wiz Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.406 2022/04/16 07:57:33 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.405 2022/03/28 13:07:14 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.406 2022/04/16 07:57:33 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -2951,6 +2951,7 @@ rf_find_raid_components(void)
 
 			vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 			error = VOP_OPEN(vp, FREAD | FSILENT, NOCRED);
+			VOP_UNLOCK(vp);
 
 			if (error) {
 /* "Who cares."  Continue looking
@@ -2970,6 +2971,7 @@ rf_find_raid_components(void)
 	printf("RAIDframe: can't get disk size"
 	" for dev %s (%d)\n",
 	device_xname(dv), error);
+vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 VOP_CLOSE(vp, FREAD | FWRITE, NOCRED);
 vput(vp);
 continue;
@@ -2981,18 +2983,19 @@ rf_find_raid_components(void)
 if (error) {
 	printf("RAIDframe: can't get wedge info for "
 	"dev %s (%d)\n", device_xname(dv), error);
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	VOP_CLOSE(vp, FREAD | FWRITE, NOCRED);
 	vput(vp);
 	continue;
 }
 
 if (strcmp(dkw.dkw_ptype, DKW_PTYPE_RAIDFRAME) != 0) {
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	VOP_CLOSE(vp, FREAD | FWRITE, NOCRED);
 	vput(vp);
 	continue;
 }
 
-VOP_UNLOCK(vp);
 ac_list = rf_get_component(ac_list, dev, vp,
 device_xname(dv), dkw.dkw_size, numsecs, secsize);
 rf_part_found = 1; /*There is a raid component on this disk*/
@@ -3013,6 +3016,7 @@ rf_find_raid_components(void)
 
 			/* don't need this any more.  We'll allocate it again
 			   a little later if we really do... */
+			vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 			VOP_CLOSE(vp, FREAD | FWRITE, NOCRED);
 			vput(vp);
 



CVS commit: src/sys/dev/raidframe

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:57:33 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Unlock vnode for VOP_IOCTL().


To generate a diff of this commit:
cvs rdiff -u -r1.405 -r1.406 src/sys/dev/raidframe/rf_netbsdkintf.c

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



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:56:45 UTC 2022

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: vdev_disk.c

Log Message:
Unlock vnode for VOP_IOCTL().


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.19 src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.20
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.19	Sat Nov 28 22:53:06 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c	Sat Apr 16 07:56:45 2022
@@ -132,9 +132,7 @@ vdev_disk_flush(struct work *work, void 
 	KASSERT(vp == dvd->vd_vp);
 
 	cmd = 1;
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	error = VOP_IOCTL(vp, DIOCCACHESYNC, , FREAD|FWRITE, kcred);
-	VOP_UNLOCK(vp, 0);
 	bp->b_error = error;
 	vdev_disk_io_intr(bp);
 }



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:56:45 UTC 2022

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: vdev_disk.c

Log Message:
Unlock vnode for VOP_IOCTL().


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c

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



CVS commit: src/libexec/ld.elf_so

2022-03-30 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Mar 30 08:26:45 UTC 2022

Modified Files:
src/libexec/ld.elf_so: map_object.c

Log Message:
_rtld_map_object(): no need to mmap an empty bss segment.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/libexec/ld.elf_so/map_object.c

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

Modified files:

Index: src/libexec/ld.elf_so/map_object.c
diff -u src/libexec/ld.elf_so/map_object.c:1.61 src/libexec/ld.elf_so/map_object.c:1.62
--- src/libexec/ld.elf_so/map_object.c:1.61	Wed Mar  4 01:21:17 2020
+++ src/libexec/ld.elf_so/map_object.c	Wed Mar 30 08:26:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: map_object.c,v 1.61 2020/03/04 01:21:17 thorpej Exp $	 */
+/*	$NetBSD: map_object.c,v 1.62 2022/03/30 08:26:45 hannken Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -34,7 +34,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: map_object.c,v 1.61 2020/03/04 01:21:17 thorpej Exp $");
+__RCSID("$NetBSD: map_object.c,v 1.62 2022/03/30 08:26:45 hannken Exp $");
 #endif /* not lint */
 
 #include 
@@ -371,11 +371,13 @@ _rtld_map_object(const char *path, int f
 	}
 
 	/* Overlay the bss segment onto the proper region. */
-	if (mmap(mapbase + data_vlimit - base_vaddr, base_vlimit - data_vlimit,
-	data_flags, MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0) ==
-	MAP_FAILED) {
-		_rtld_error("mmap of bss failed: %s", xstrerror(errno));
-		goto bad;
+	if (base_vlimit > data_vlimit) {
+		if (mmap(mapbase + data_vlimit - base_vaddr,
+		base_vlimit - data_vlimit, data_flags,
+		MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0) == MAP_FAILED) {
+			_rtld_error("mmap of bss failed: %s", xstrerror(errno));
+			goto bad;
+		}
 	}
 
 	/* Unmap the gap between the text and data. */



CVS commit: src/libexec/ld.elf_so

2022-03-30 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Mar 30 08:26:45 UTC 2022

Modified Files:
src/libexec/ld.elf_so: map_object.c

Log Message:
_rtld_map_object(): no need to mmap an empty bss segment.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/libexec/ld.elf_so/map_object.c

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



CVS commit: src/sys/uvm

2022-03-27 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun Mar 27 20:18:05 UTC 2022

Modified Files:
src/sys/uvm: uvm_mmap.c

Log Message:
Make mmap() with "len == 0" an error if not MAP_ANON.  We should return
an error for MAP_ANON too but unfortunately our /libexec/ld.elf_so
sometimes creates an empty anon mapping for the bss of a shared library.

At least FreeBSD and Solaris return this error too and according to POSIX
"If len is zero, mmap() shall fail and no mapping shall be established".

Fixes PR pkg/56338 Installing qt5-qtdeclarative leaves a dangling reference

The dangling reference here originates from vn_mmap() taking a vnode
reference for this empty mapping that will never be released.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/uvm/uvm_mmap.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/uvm/uvm_mmap.c
diff -u src/sys/uvm/uvm_mmap.c:1.176 src/sys/uvm/uvm_mmap.c:1.177
--- src/sys/uvm/uvm_mmap.c:1.176	Wed Jul 21 06:35:45 2021
+++ src/sys/uvm/uvm_mmap.c	Sun Mar 27 20:18:05 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_mmap.c,v 1.176 2021/07/21 06:35:45 skrll Exp $	*/
+/*	$NetBSD: uvm_mmap.c,v 1.177 2022/03/27 20:18:05 hannken Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.176 2021/07/21 06:35:45 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.177 2022/03/27 20:18:05 hannken Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_pax.h"
@@ -304,6 +304,9 @@ sys_mmap(struct lwp *l, const struct sys
 	if ((flags & (MAP_SHARED|MAP_PRIVATE)) == (MAP_SHARED|MAP_PRIVATE))
 		return EINVAL;
 
+	if (size == 0 && (flags & MAP_ANON) == 0)
+		return EINVAL;
+
 	/*
 	 * align file position and save offset.  adjust size.
 	 */



CVS commit: src/sys/uvm

2022-03-27 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun Mar 27 20:18:05 UTC 2022

Modified Files:
src/sys/uvm: uvm_mmap.c

Log Message:
Make mmap() with "len == 0" an error if not MAP_ANON.  We should return
an error for MAP_ANON too but unfortunately our /libexec/ld.elf_so
sometimes creates an empty anon mapping for the bss of a shared library.

At least FreeBSD and Solaris return this error too and according to POSIX
"If len is zero, mmap() shall fail and no mapping shall be established".

Fixes PR pkg/56338 Installing qt5-qtdeclarative leaves a dangling reference

The dangling reference here originates from vn_mmap() taking a vnode
reference for this empty mapping that will never be released.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/uvm/uvm_mmap.c

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



CVS commit: src/sys/net

2022-03-25 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Mar 25 08:57:51 UTC 2022

Modified Files:
src/sys/net: if_wg.c

Log Message:
Prevent memory corruption from wg_send_handshake_msg_init() on
LP64 machines with "MSIZE == 256", sparc64 for example.

wg_send_handshake_msg_init() tries to put 148 bytes into a buffer
of 144 bytes and overwrites 4 bytes following the mbuf.  Check
for "sizeof() > MHLEN" and use a cluster in this case.

With help from Taylor R Campbell 


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/net/if_wg.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/net/if_wg.c
diff -u src/sys/net/if_wg.c:1.68 src/sys/net/if_wg.c:1.69
--- src/sys/net/if_wg.c:1.68	Sun Jan 16 20:43:20 2022
+++ src/sys/net/if_wg.c	Fri Mar 25 08:57:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wg.c,v 1.68 2022/01/16 20:43:20 riastradh Exp $	*/
+/*	$NetBSD: if_wg.c,v 1.69 2022/03/25 08:57:50 hannken Exp $	*/
 
 /*
  * Copyright (C) Ryota Ozaki 
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.68 2022/01/16 20:43:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.69 2022/03/25 08:57:50 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altq_enabled.h"
@@ -1707,6 +1707,10 @@ wg_send_handshake_msg_init(struct wg_sof
 	wgs->wgs_state = WGS_STATE_INIT_ACTIVE;
 
 	m = m_gethdr(M_WAIT, MT_DATA);
+	if (sizeof(*wgmi) > MHLEN) {
+		m_clget(m, M_WAIT);
+		CTASSERT(sizeof(*wgmi) <= MCLBYTES);
+	}
 	m->m_pkthdr.len = m->m_len = sizeof(*wgmi);
 	wgmi = mtod(m, struct wg_msg_init *);
 	wg_fill_msg_init(wg, wgp, wgs, wgmi);
@@ -2056,6 +2060,10 @@ wg_send_handshake_msg_resp(struct wg_sof
 	KASSERT(wgs->wgs_state == WGS_STATE_INIT_PASSIVE);
 
 	m = m_gethdr(M_WAIT, MT_DATA);
+	if (sizeof(*wgmr) > MHLEN) {
+		m_clget(m, M_WAIT);
+		CTASSERT(sizeof(*wgmr) <= MCLBYTES);
+	}
 	m->m_pkthdr.len = m->m_len = sizeof(*wgmr);
 	wgmr = mtod(m, struct wg_msg_resp *);
 	wg_fill_msg_resp(wg, wgp, wgs, wgmr, wgmi);
@@ -2154,6 +2162,10 @@ wg_send_cookie_msg(struct wg_softc *wg, 
 	KASSERT(mutex_owned(wgp->wgp_lock));
 
 	m = m_gethdr(M_WAIT, MT_DATA);
+	if (sizeof(*wgmc) > MHLEN) {
+		m_clget(m, M_WAIT);
+		CTASSERT(sizeof(*wgmc) <= MCLBYTES);
+	}
 	m->m_pkthdr.len = m->m_len = sizeof(*wgmc);
 	wgmc = mtod(m, struct wg_msg_cookie *);
 	wg_fill_msg_cookie(wg, wgp, wgmc, sender, mac1, src);



CVS commit: src/sys/net

2022-03-25 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Mar 25 08:57:51 UTC 2022

Modified Files:
src/sys/net: if_wg.c

Log Message:
Prevent memory corruption from wg_send_handshake_msg_init() on
LP64 machines with "MSIZE == 256", sparc64 for example.

wg_send_handshake_msg_init() tries to put 148 bytes into a buffer
of 144 bytes and overwrites 4 bytes following the mbuf.  Check
for "sizeof() > MHLEN" and use a cluster in this case.

With help from Taylor R Campbell 


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/net/if_wg.c

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



CVS commit: src/sys/kern

2022-03-25 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Mar 25 08:57:15 UTC 2022

Modified Files:
src/sys/kern: vfs_vnops.c

Log Message:
It is impossible for VOP_LOCK() to return ENOENT with LK_RETRY flag.
Remove the second call to VOP_LOCK().

Enable assertion "vrefcnt(vp) > 0" and assert all possible errors
for all LK_RETRY/LK_NOWAIT combinations.


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/sys/kern/vfs_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/kern/vfs_vnops.c
diff -u src/sys/kern/vfs_vnops.c:1.226 src/sys/kern/vfs_vnops.c:1.227
--- src/sys/kern/vfs_vnops.c:1.226	Sat Mar 19 13:50:02 2022
+++ src/sys/kern/vfs_vnops.c	Fri Mar 25 08:57:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnops.c,v 1.226 2022/03/19 13:50:02 hannken Exp $	*/
+/*	$NetBSD: vfs_vnops.c,v 1.227 2022/03/25 08:57:15 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.226 2022/03/19 13:50:02 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.227 2022/03/25 08:57:15 hannken Exp $");
 
 #include "veriexec.h"
 
@@ -1192,9 +1192,7 @@ vn_lock(struct vnode *vp, int flags)
 	struct lwp *l;
 	int error;
 
-#if 0
-	KASSERT(vrefcnt(vp) > 0 || (vp->v_iflag & VI_ONWORKLST) != 0);
-#endif
+	KASSERT(vrefcnt(vp) > 0);
 	KASSERT((flags & ~(LK_SHARED|LK_EXCLUSIVE|LK_NOWAIT|LK_RETRY|
 	LK_UPGRADE|LK_DOWNGRADE)) == 0);
 	KASSERT((flags & LK_NOWAIT) != 0 || !mutex_owned(vp->v_interlock));
@@ -1210,13 +1208,23 @@ vn_lock(struct vnode *vp, int flags)
 	l->l_rwcallsite = (uintptr_t)__builtin_return_address(0);	
 
 	error = VOP_LOCK(vp, flags);
-	if ((flags & LK_RETRY) != 0 && error == ENOENT)
-		error = VOP_LOCK(vp, flags);
 
 	l->l_rwcallsite = 0;
 
-	KASSERT((flags & LK_RETRY) == 0 || (flags & LK_NOWAIT) != 0 ||
-	error == 0);
+	switch (flags & (LK_RETRY | LK_NOWAIT)) {
+	case 0:
+		KASSERT(error == 0 || error == ENOENT);
+		break;
+	case LK_RETRY:
+		KASSERT(error == 0);
+		break;
+	case LK_NOWAIT:
+		KASSERT(error == 0 || error == EBUSY || error == ENOENT);
+		break;
+	case LK_RETRY | LK_NOWAIT:
+		KASSERT(error == 0 || error == EBUSY);
+		break;
+	}
 
 	return error;
 }



CVS commit: src/sys/kern

2022-03-25 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Mar 25 08:57:15 UTC 2022

Modified Files:
src/sys/kern: vfs_vnops.c

Log Message:
It is impossible for VOP_LOCK() to return ENOENT with LK_RETRY flag.
Remove the second call to VOP_LOCK().

Enable assertion "vrefcnt(vp) > 0" and assert all possible errors
for all LK_RETRY/LK_NOWAIT combinations.


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/sys/kern/vfs_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/sys

2022-03-25 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Mar 25 08:56:36 UTC 2022

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

Log Message:
As VV_LOCKSWORK is gone remove LOCKSWORK from VNODE_FLAGBITS string.
Also convert illegal octal number 18 to 20.


To generate a diff of this commit:
cvs rdiff -u -r1.300 -r1.301 src/sys/sys/vnode.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/sys/vnode.h
diff -u src/sys/sys/vnode.h:1.300 src/sys/sys/vnode.h:1.301
--- src/sys/sys/vnode.h:1.300	Sat Mar 19 13:53:32 2022
+++ src/sys/sys/vnode.h	Fri Mar 25 08:56:36 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnode.h,v 1.300 2022/03/19 13:53:32 hannken Exp $	*/
+/*	$NetBSD: vnode.h,v 1.301 2022/03/25 08:56:36 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -221,8 +221,8 @@ typedef struct vnode vnode_t;
 #define	VU_DIROP	0x0100	/* LFS: involved in a directory op */
 
 #define	VNODE_FLAGBITS \
-"\20\1ROOT\2SYSTEM\3ISTTY\4MAPPED\5MPSAFE\6LOCKSWORK\11TEXT\12EXECMAP" \
-"\13WRMAP\14PAGES\17ONWORKLST\18DEADCHECK\31DIROP"
+"\20\1ROOT\2SYSTEM\3ISTTY\4MAPPED\5MPSAFE\11TEXT\12EXECMAP" \
+"\13WRMAP\14PAGES\17ONWORKLST\20DEADCHECK\31DIROP"
 
 #define	VSIZENOTSET	((voff_t)-1)
 



CVS commit: src/sys/sys

2022-03-25 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Mar 25 08:56:36 UTC 2022

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

Log Message:
As VV_LOCKSWORK is gone remove LOCKSWORK from VNODE_FLAGBITS string.
Also convert illegal octal number 18 to 20.


To generate a diff of this commit:
cvs rdiff -u -r1.300 -r1.301 src/sys/sys/vnode.h

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



CVS commit: src

2022-03-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar 19 13:53:33 UTC 2022

Modified Files:
src/share/man/man9: vnode.9
src/sys/fs/efs: efs_vfsops.c
src/sys/fs/hfs: hfs_vfsops.c
src/sys/fs/union: union_subr.c
src/sys/kern: vfs_vnode.c vnode_if.sh
src/sys/miscfs/deadfs: dead_vfsops.c
src/sys/sys: param.h vnode.h
src/sys/ufs/chfs: chfs_vfsops.c
src/sys/ufs/ext2fs: ext2fs_vfsops.c
src/sys/ufs/ffs: ffs_vfsops.c
src/sys/ufs/lfs: lfs_vfsops.c
src/sys/ufs/mfs: mfs_vfsops.c

Log Message:
Remove now unused VV_LOCKSWORK, all file systems support locking.

Remove unused predicates vn_locked() and vn_anylocked().

Welcome to 9.99.95


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/share/man/man9/vnode.9
cvs rdiff -u -r1.29 -r1.30 src/sys/fs/efs/efs_vfsops.c
cvs rdiff -u -r1.37 -r1.38 src/sys/fs/hfs/hfs_vfsops.c
cvs rdiff -u -r1.80 -r1.81 src/sys/fs/union/union_subr.c
cvs rdiff -u -r1.138 -r1.139 src/sys/kern/vfs_vnode.c
cvs rdiff -u -r1.72 -r1.73 src/sys/kern/vnode_if.sh
cvs rdiff -u -r1.10 -r1.11 src/sys/miscfs/deadfs/dead_vfsops.c
cvs rdiff -u -r1.707 -r1.708 src/sys/sys/param.h
cvs rdiff -u -r1.299 -r1.300 src/sys/sys/vnode.h
cvs rdiff -u -r1.22 -r1.23 src/sys/ufs/chfs/chfs_vfsops.c
cvs rdiff -u -r1.219 -r1.220 src/sys/ufs/ext2fs/ext2fs_vfsops.c
cvs rdiff -u -r1.374 -r1.375 src/sys/ufs/ffs/ffs_vfsops.c
cvs rdiff -u -r1.381 -r1.382 src/sys/ufs/lfs/lfs_vfsops.c
cvs rdiff -u -r1.115 -r1.116 src/sys/ufs/mfs/mfs_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/share/man/man9/vnode.9
diff -u src/share/man/man9/vnode.9:1.83 src/share/man/man9/vnode.9:1.84
--- src/share/man/man9/vnode.9:1.83	Mon Jan 17 19:08:06 2022
+++ src/share/man/man9/vnode.9	Sat Mar 19 13:53:32 2022
@@ -1,4 +1,4 @@
-.\" $NetBSD: vnode.9,v 1.83 2022/01/17 19:08:06 christos Exp $
+.\" $NetBSD: vnode.9,v 1.84 2022/03/19 13:53:32 hannken Exp $
 .\"
 .\" Copyright (c) 2001, 2005, 2006 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd January 17, 2022
+.Dd March 19, 2022
 .Dt VNODE 9
 .Os
 .Sh NAME
@@ -216,8 +216,6 @@ This vnode represents a tty; used when r
 This vnode might have user mappings.
 .It Dv VV_MPSAFE
 This file system is MP safe.
-.It Dv VV_LOCKSWORK
-This vnode's file system supports locking.
 .It Dv VI_TEXT
 This vnode is a pure text prototype.
 .It Dv VI_EXECMAP

Index: src/sys/fs/efs/efs_vfsops.c
diff -u src/sys/fs/efs/efs_vfsops.c:1.29 src/sys/fs/efs/efs_vfsops.c:1.30
--- src/sys/fs/efs/efs_vfsops.c:1.29	Fri Jan 17 20:08:07 2020
+++ src/sys/fs/efs/efs_vfsops.c	Sat Mar 19 13:53:32 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: efs_vfsops.c,v 1.29 2020/01/17 20:08:07 ad Exp $	*/
+/*	$NetBSD: efs_vfsops.c,v 1.30 2022/03/19 13:53:32 hannken Exp $	*/
 
 /*
  * Copyright (c) 2006 Stephen M. Rumble 
@@ -17,7 +17,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: efs_vfsops.c,v 1.29 2020/01/17 20:08:07 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: efs_vfsops.c,v 1.30 2022/03/19 13:53:32 hannken Exp $");
 
 #include 
 #include 
@@ -439,7 +439,6 @@ efs_loadvnode(struct mount *mp, struct v
 	}
 
 	vp->v_tag = VT_EFS;
-	vp->v_vflag |= VV_LOCKSWORK;
 	vp->v_data = eip;
 	genfs_node_init(vp, _genfsops);
 	uvm_vnp_setsize(vp, eip->ei_size);

Index: src/sys/fs/hfs/hfs_vfsops.c
diff -u src/sys/fs/hfs/hfs_vfsops.c:1.37 src/sys/fs/hfs/hfs_vfsops.c:1.38
--- src/sys/fs/hfs/hfs_vfsops.c:1.37	Fri Feb 28 11:27:38 2020
+++ src/sys/fs/hfs/hfs_vfsops.c	Sat Mar 19 13:53:32 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: hfs_vfsops.c,v 1.37 2020/02/28 11:27:38 kamil Exp $	*/
+/*	$NetBSD: hfs_vfsops.c,v 1.38 2022/03/19 13:53:32 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -99,7 +99,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hfs_vfsops.c,v 1.37 2020/02/28 11:27:38 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hfs_vfsops.c,v 1.38 2022/03/19 13:53:32 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -583,7 +583,6 @@ hfs_loadvnode(struct mount *mp, struct v
 
 	vp->v_tag = VT_HFS;
 	vp->v_op = hfs_vnodeop_p;
-	vp->v_vflag |= VV_LOCKSWORK;
 	vp->v_data = hnode;
 	genfs_node_init(vp, _genfsops);
 

Index: src/sys/fs/union/union_subr.c
diff -u src/sys/fs/union/union_subr.c:1.80 src/sys/fs/union/union_subr.c:1.81
--- src/sys/fs/union/union_subr.c:1.80	Sat Mar 19 13:48:04 2022
+++ src/sys/fs/union/union_subr.c	Sat Mar 19 13:53:32 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: union_subr.c,v 1.80 2022/03/19 13:48:04 hannken Exp $	*/
+/*	$NetBSD: union_subr.c,v 1.81 2022/03/19 13:53:32 hannken Exp $	*/
 
 /*
  * Copyright (c) 1994
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.80 2022/03/19 13:48:04 hannken Exp $");
+__KERNEL_RCSID(0, 

CVS commit: src

2022-03-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar 19 13:53:33 UTC 2022

Modified Files:
src/share/man/man9: vnode.9
src/sys/fs/efs: efs_vfsops.c
src/sys/fs/hfs: hfs_vfsops.c
src/sys/fs/union: union_subr.c
src/sys/kern: vfs_vnode.c vnode_if.sh
src/sys/miscfs/deadfs: dead_vfsops.c
src/sys/sys: param.h vnode.h
src/sys/ufs/chfs: chfs_vfsops.c
src/sys/ufs/ext2fs: ext2fs_vfsops.c
src/sys/ufs/ffs: ffs_vfsops.c
src/sys/ufs/lfs: lfs_vfsops.c
src/sys/ufs/mfs: mfs_vfsops.c

Log Message:
Remove now unused VV_LOCKSWORK, all file systems support locking.

Remove unused predicates vn_locked() and vn_anylocked().

Welcome to 9.99.95


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/share/man/man9/vnode.9
cvs rdiff -u -r1.29 -r1.30 src/sys/fs/efs/efs_vfsops.c
cvs rdiff -u -r1.37 -r1.38 src/sys/fs/hfs/hfs_vfsops.c
cvs rdiff -u -r1.80 -r1.81 src/sys/fs/union/union_subr.c
cvs rdiff -u -r1.138 -r1.139 src/sys/kern/vfs_vnode.c
cvs rdiff -u -r1.72 -r1.73 src/sys/kern/vnode_if.sh
cvs rdiff -u -r1.10 -r1.11 src/sys/miscfs/deadfs/dead_vfsops.c
cvs rdiff -u -r1.707 -r1.708 src/sys/sys/param.h
cvs rdiff -u -r1.299 -r1.300 src/sys/sys/vnode.h
cvs rdiff -u -r1.22 -r1.23 src/sys/ufs/chfs/chfs_vfsops.c
cvs rdiff -u -r1.219 -r1.220 src/sys/ufs/ext2fs/ext2fs_vfsops.c
cvs rdiff -u -r1.374 -r1.375 src/sys/ufs/ffs/ffs_vfsops.c
cvs rdiff -u -r1.381 -r1.382 src/sys/ufs/lfs/lfs_vfsops.c
cvs rdiff -u -r1.115 -r1.116 src/sys/ufs/mfs/mfs_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/miscfs/genfs

2022-03-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar 19 13:52:45 UTC 2022

Modified Files:
src/sys/miscfs/genfs: genfs_vnops.c

Log Message:
Remove now unused genfs_nolock(), genfs_nounlock() and genfs_noislocked().


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/sys/miscfs/genfs/genfs_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/miscfs/genfs/genfs_vnops.c
diff -u src/sys/miscfs/genfs/genfs_vnops.c:1.216 src/sys/miscfs/genfs/genfs_vnops.c:1.217
--- src/sys/miscfs/genfs/genfs_vnops.c:1.216	Wed Oct 20 03:08:18 2021
+++ src/sys/miscfs/genfs/genfs_vnops.c	Sat Mar 19 13:52:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfs_vnops.c,v 1.216 2021/10/20 03:08:18 thorpej Exp $	*/
+/*	$NetBSD: genfs_vnops.c,v 1.217 2022/03/19 13:52:45 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.216 2021/10/20 03:08:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.217 2022/03/19 13:52:45 hannken Exp $");
 
 #include 
 #include 
@@ -425,30 +425,6 @@ genfs_islocked(void *v)
 	return 0;
 }
 
-/*
- * Stubs to use when there is no locking to be done on the underlying object.
- */
-int
-genfs_nolock(void *v)
-{
-
-	return (0);
-}
-
-int
-genfs_nounlock(void *v)
-{
-
-	return (0);
-}
-
-int
-genfs_noislocked(void *v)
-{
-
-	return (0);
-}
-
 int
 genfs_mmap(void *v)
 {



CVS commit: src/sys/miscfs/genfs

2022-03-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar 19 13:52:45 UTC 2022

Modified Files:
src/sys/miscfs/genfs: genfs_vnops.c

Log Message:
Remove now unused genfs_nolock(), genfs_nounlock() and genfs_noislocked().


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/sys/miscfs/genfs/genfs_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

2022-03-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar 19 13:52:11 UTC 2022

Modified Files:
src/sys/kern: vfs_vnode.c
src/sys/miscfs/deadfs: dead_vfsops.c
src/sys/miscfs/specfs: spec_vnops.c

Log Message:
Switch spec_vnodeop vector to real vnode locking, VV_LOCKSWORK now.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/kern/vfs_vnode.c
cvs rdiff -u -r1.9 -r1.10 src/sys/miscfs/deadfs/dead_vfsops.c
cvs rdiff -u -r1.183 -r1.184 src/sys/miscfs/specfs/spec_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/kern/vfs_vnode.c
diff -u src/sys/kern/vfs_vnode.c:1.137 src/sys/kern/vfs_vnode.c:1.138
--- src/sys/kern/vfs_vnode.c:1.137	Tue Mar 15 15:27:43 2022
+++ src/sys/kern/vfs_vnode.c	Sat Mar 19 13:52:11 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnode.c,v 1.137 2022/03/15 15:27:43 hannken Exp $	*/
+/*	$NetBSD: vfs_vnode.c,v 1.138 2022/03/19 13:52:11 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011, 2019, 2020 The NetBSD Foundation, Inc.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.137 2022/03/15 15:27:43 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.138 2022/03/19 13:52:11 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pax.h"
@@ -1993,8 +1993,7 @@ vcache_make_anon(vnode_t *vp)
 	/* Done with purge, change operations vector. */
 	mutex_enter(vp->v_interlock);
 	vp->v_op = spec_vnodeop_p;
-	vp->v_vflag |= VV_MPSAFE;
-	vp->v_vflag &= ~VV_LOCKSWORK;
+	vp->v_vflag |= VV_MPSAFE | VV_LOCKSWORK;
 	mutex_exit(vp->v_interlock);
 
 	/*

Index: src/sys/miscfs/deadfs/dead_vfsops.c
diff -u src/sys/miscfs/deadfs/dead_vfsops.c:1.9 src/sys/miscfs/deadfs/dead_vfsops.c:1.10
--- src/sys/miscfs/deadfs/dead_vfsops.c:1.9	Tue Jan  1 10:06:54 2019
+++ src/sys/miscfs/deadfs/dead_vfsops.c	Sat Mar 19 13:52:11 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: dead_vfsops.c,v 1.9 2019/01/01 10:06:54 hannken Exp $	*/
+/*	$NetBSD: dead_vfsops.c,v 1.10 2022/03/19 13:52:11 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dead_vfsops.c,v 1.9 2019/01/01 10:06:54 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dead_vfsops.c,v 1.10 2022/03/19 13:52:11 hannken Exp $");
 
 #include 
 #include 
@@ -104,7 +104,7 @@ dead_newvnode(struct mount *mp, struct v
 	vp->v_tag = VT_NON;
 	vp->v_type = vap->va_type;
 	vp->v_op = spec_vnodeop_p;
-	vp->v_vflag |= VV_MPSAFE;
+	vp->v_vflag |= VV_MPSAFE | VV_LOCKSWORK;
 	uvm_vnp_setsize(vp, 0);
 	spec_node_init(vp, vap->va_rdev);
 

Index: src/sys/miscfs/specfs/spec_vnops.c
diff -u src/sys/miscfs/specfs/spec_vnops.c:1.183 src/sys/miscfs/specfs/spec_vnops.c:1.184
--- src/sys/miscfs/specfs/spec_vnops.c:1.183	Sun Jul 18 23:57:14 2021
+++ src/sys/miscfs/specfs/spec_vnops.c	Sat Mar 19 13:52:11 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: spec_vnops.c,v 1.183 2021/07/18 23:57:14 dholland Exp $	*/
+/*	$NetBSD: spec_vnops.c,v 1.184 2022/03/19 13:52:11 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.183 2021/07/18 23:57:14 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.184 2022/03/19 13:52:11 hannken Exp $");
 
 #include 
 #include 
@@ -148,12 +148,12 @@ const struct vnodeopv_entry_desc spec_vn
 	{ _abortop_desc, genfs_badop },		/* abortop */
 	{ _inactive_desc, spec_inactive },		/* inactive */
 	{ _reclaim_desc, spec_reclaim },		/* reclaim */
-	{ _lock_desc, genfs_nolock },		/* lock */
-	{ _unlock_desc, genfs_nounlock },		/* unlock */
+	{ _lock_desc, genfs_lock },			/* lock */
+	{ _unlock_desc, genfs_unlock },		/* unlock */
 	{ _bmap_desc, spec_bmap },			/* bmap */
 	{ _strategy_desc, spec_strategy },		/* strategy */
 	{ _print_desc, spec_print },		/* print */
-	{ _islocked_desc, genfs_noislocked },	/* islocked */
+	{ _islocked_desc, genfs_islocked },		/* islocked */
 	{ _pathconf_desc, spec_pathconf },		/* pathconf */
 	{ _advlock_desc, spec_advlock },		/* advlock */
 	{ _bwrite_desc, vn_bwrite },		/* bwrite */



CVS commit: src/sys

2022-03-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar 19 13:52:11 UTC 2022

Modified Files:
src/sys/kern: vfs_vnode.c
src/sys/miscfs/deadfs: dead_vfsops.c
src/sys/miscfs/specfs: spec_vnops.c

Log Message:
Switch spec_vnodeop vector to real vnode locking, VV_LOCKSWORK now.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/kern/vfs_vnode.c
cvs rdiff -u -r1.9 -r1.10 src/sys/miscfs/deadfs/dead_vfsops.c
cvs rdiff -u -r1.183 -r1.184 src/sys/miscfs/specfs/spec_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

2022-03-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar 19 13:51:35 UTC 2022

Modified Files:
src/sys/arch/evbarm/fdt: fdt_machdep.c
src/sys/arch/x86/x86: x86_autoconf.c
src/sys/arch/zaurus/zaurus: autoconf.c
src/sys/kern: init_main.c kern_subr.c

Log Message:
Fix locking after opendisk(), VOP_IOCTL() needs an unlocked vnode,
vn_rdwr() needs flag IO_NODELOCKED.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/arch/evbarm/fdt/fdt_machdep.c
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/x86/x86/x86_autoconf.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/zaurus/zaurus/autoconf.c
cvs rdiff -u -r1.537 -r1.538 src/sys/kern/init_main.c
cvs rdiff -u -r1.229 -r1.230 src/sys/kern/kern_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/arch/evbarm/fdt/fdt_machdep.c
diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.89 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.90
--- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.89	Sat Mar 19 09:55:30 2022
+++ src/sys/arch/evbarm/fdt/fdt_machdep.c	Sat Mar 19 13:51:35 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_machdep.c,v 1.89 2022/03/19 09:55:30 skrll Exp $ */
+/* $NetBSD: fdt_machdep.c,v 1.90 2022/03/19 13:51:35 hannken Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.89 2022/03/19 09:55:30 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.90 2022/03/19 13:51:35 hannken Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bootconfig.h"
@@ -774,7 +774,7 @@ fdt_detect_root_device(device_t dev)
 		if (!vp)
 			return;
 		error = vn_rdwr(UIO_READ, vp, buf, sizeof(buf), 0, UIO_SYSSPACE,
-		0, NOCRED, , NULL);
+		IO_NODELOCKED, NOCRED, , NULL);
 		VOP_CLOSE(vp, FREAD, NOCRED);
 		vput(vp);
 

Index: src/sys/arch/x86/x86/x86_autoconf.c
diff -u src/sys/arch/x86/x86/x86_autoconf.c:1.86 src/sys/arch/x86/x86/x86_autoconf.c:1.87
--- src/sys/arch/x86/x86/x86_autoconf.c:1.86	Sat Feb 12 03:24:35 2022
+++ src/sys/arch/x86/x86/x86_autoconf.c	Sat Mar 19 13:51:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_autoconf.c,v 1.86 2022/02/12 03:24:35 riastradh Exp $	*/
+/*	$NetBSD: x86_autoconf.c,v 1.87 2022/03/19 13:51:35 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.86 2022/02/12 03:24:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.87 2022/03/19 13:51:35 hannken Exp $");
 
 #include 
 #include 
@@ -178,7 +178,7 @@ matchbiosdisks(void)
 		}
 
 		error = vn_rdwr(UIO_READ, tv, mbr, DEV_BSIZE, 0, UIO_SYSSPACE,
-		0, NOCRED, NULL, NULL);
+		IO_NODELOCKED, NOCRED, NULL, NULL);
 		VOP_CLOSE(tv, FREAD, NOCRED);
 		vput(tv);
 		if (error) {
@@ -243,7 +243,7 @@ match_bootwedge(device_t dv, struct btin
 	 nblks != 0; nblks--, blk++) {
 		error = vn_rdwr(UIO_READ, tmpvn, (void *) bf,
 		sizeof(bf), blk * DEV_BSIZE, UIO_SYSSPACE,
-		0, NOCRED, NULL, NULL);
+		IO_NODELOCKED, NOCRED, NULL, NULL);
 		if (error) {
 			if (error != EINVAL) {
 aprint_error("%s: unable to read block %"
@@ -298,7 +298,9 @@ match_bootdisk(device_t dv, struct btinf
 		return 0;
 	}
 
+	VOP_UNLOCK(tmpvn);
 	error = VOP_IOCTL(tmpvn, DIOCGDINFO, , FREAD, NOCRED);
+	vn_lock(tmpvn, LK_EXCLUSIVE | LK_RETRY);
 	if (error) {
 		/*
 		 * XXX Can't happen -- open() would have errored out

Index: src/sys/arch/zaurus/zaurus/autoconf.c
diff -u src/sys/arch/zaurus/zaurus/autoconf.c:1.15 src/sys/arch/zaurus/zaurus/autoconf.c:1.16
--- src/sys/arch/zaurus/zaurus/autoconf.c:1.15	Sat Feb 12 03:24:35 2022
+++ src/sys/arch/zaurus/zaurus/autoconf.c	Sat Mar 19 13:51:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.15 2022/02/12 03:24:35 riastradh Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.16 2022/03/19 13:51:35 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.15 2022/02/12 03:24:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.16 2022/03/19 13:51:35 hannken Exp $");
 
 #include "opt_md.h"
 
@@ -109,7 +109,9 @@ match_bootdisk(device_t dv, struct btinf
 	if ((tmpvn = opendisk(dv)) == NULL)
 		return 0;
 
+	VOP_UNLOCK(tmpvn);
 	error = VOP_IOCTL(tmpvn, DIOCGDINFO, , FREAD, NOCRED);
+	vn_lock(tmpvn, LK_EXCLUSIVE | LK_RETRY);
 	if (error) {
 		/*
 		 * XXX Can't happen -- open() would have errored out

Index: src/sys/kern/init_main.c
diff -u src/sys/kern/init_main.c:1.537 src/sys/kern/init_main.c:1.538
--- src/sys/kern/init_main.c:1.537	Fri Mar 18 23:37:06 2022
+++ src/sys/kern/init_main.c	Sat Mar 19 13:51:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_main.c,v 1.537 2022/03/18 23:37:06 riastradh Exp $	*/
+/*	$NetBSD: init_main.c,v 1.538 2022/03/19 13:51:35 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009, 2019 The NetBSD Foundation, 

CVS commit: src/sys

2022-03-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar 19 13:51:35 UTC 2022

Modified Files:
src/sys/arch/evbarm/fdt: fdt_machdep.c
src/sys/arch/x86/x86: x86_autoconf.c
src/sys/arch/zaurus/zaurus: autoconf.c
src/sys/kern: init_main.c kern_subr.c

Log Message:
Fix locking after opendisk(), VOP_IOCTL() needs an unlocked vnode,
vn_rdwr() needs flag IO_NODELOCKED.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/arch/evbarm/fdt/fdt_machdep.c
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/x86/x86/x86_autoconf.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/zaurus/zaurus/autoconf.c
cvs rdiff -u -r1.537 -r1.538 src/sys/kern/init_main.c
cvs rdiff -u -r1.229 -r1.230 src/sys/kern/kern_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/dev/ata

2022-03-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar 19 13:51:01 UTC 2022

Modified Files:
src/sys/dev/ata: ata_raid_adaptec.c ata_raid_intel.c ata_raid_jmicron.c
ata_raid_nvidia.c ata_raid_promise.c ata_raid_subr.c ata_raid_via.c

Log Message:
Lock vnode across VOP_OPEN.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ata/ata_raid_adaptec.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ata/ata_raid_intel.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ata/ata_raid_jmicron.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ata/ata_raid_nvidia.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ata/ata_raid_promise.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ata/ata_raid_subr.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ata/ata_raid_via.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/dev/ata/ata_raid_adaptec.c
diff -u src/sys/dev/ata/ata_raid_adaptec.c:1.11 src/sys/dev/ata/ata_raid_adaptec.c:1.12
--- src/sys/dev/ata/ata_raid_adaptec.c:1.11	Mon Oct 22 19:38:06 2018
+++ src/sys/dev/ata/ata_raid_adaptec.c	Sat Mar 19 13:51:01 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata_raid_adaptec.c,v 1.11 2018/10/22 19:38:06 jdolecek Exp $	*/
+/*	$NetBSD: ata_raid_adaptec.c,v 1.12 2022/03/19 13:51:01 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2000,2001,2002 Søren Schmidt 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata_raid_adaptec.c,v 1.11 2018/10/22 19:38:06 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_raid_adaptec.c,v 1.12 2022/03/19 13:51:01 hannken Exp $");
 
 #include 
 #include 
@@ -86,6 +86,7 @@ ata_raid_read_config_adaptec(struct wd_s
 	if (error)
 		goto out;
 
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	error = VOP_OPEN(vp, FREAD, NOCRED);
 	if (error) {
 		vput(vp);

Index: src/sys/dev/ata/ata_raid_intel.c
diff -u src/sys/dev/ata/ata_raid_intel.c:1.10 src/sys/dev/ata/ata_raid_intel.c:1.11
--- src/sys/dev/ata/ata_raid_intel.c:1.10	Fri Oct  4 12:24:32 2019
+++ src/sys/dev/ata/ata_raid_intel.c	Sat Mar 19 13:51:01 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata_raid_intel.c,v 1.10 2019/10/04 12:24:32 mrg Exp $	*/
+/*	$NetBSD: ata_raid_intel.c,v 1.11 2022/03/19 13:51:01 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2000-2008 Søren Schmidt 
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata_raid_intel.c,v 1.10 2019/10/04 12:24:32 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_raid_intel.c,v 1.11 2022/03/19 13:51:01 hannken Exp $");
 
 #include 
 #include 
@@ -158,6 +158,7 @@ ata_raid_read_config_intel(struct wd_sof
 	if (error)
 		goto out;
 
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	error = VOP_OPEN(vp, FREAD, NOCRED);
 	if (error) {
 		vput(vp);

Index: src/sys/dev/ata/ata_raid_jmicron.c
diff -u src/sys/dev/ata/ata_raid_jmicron.c:1.7 src/sys/dev/ata/ata_raid_jmicron.c:1.8
--- src/sys/dev/ata/ata_raid_jmicron.c:1.7	Mon Oct 22 19:38:06 2018
+++ src/sys/dev/ata/ata_raid_jmicron.c	Sat Mar 19 13:51:01 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata_raid_jmicron.c,v 1.7 2018/10/22 19:38:06 jdolecek Exp $	*/
+/*	$NetBSD: ata_raid_jmicron.c,v 1.8 2022/03/19 13:51:01 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2000-2008 Søren Schmidt 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata_raid_jmicron.c,v 1.7 2018/10/22 19:38:06 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_raid_jmicron.c,v 1.8 2022/03/19 13:51:01 hannken Exp $");
 
 #include 
 #include 
@@ -139,6 +139,7 @@ ata_raid_read_config_jmicron(struct wd_s
 	if (error)
 		goto out;
 
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	error = VOP_OPEN(vp, FREAD, NOCRED);
 	if (error) {
 		vput(vp);

Index: src/sys/dev/ata/ata_raid_nvidia.c
diff -u src/sys/dev/ata/ata_raid_nvidia.c:1.4 src/sys/dev/ata/ata_raid_nvidia.c:1.5
--- src/sys/dev/ata/ata_raid_nvidia.c:1.4	Mon Oct 22 19:38:06 2018
+++ src/sys/dev/ata/ata_raid_nvidia.c	Sat Mar 19 13:51:01 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata_raid_nvidia.c,v 1.4 2018/10/22 19:38:06 jdolecek Exp $	*/
+/*	$NetBSD: ata_raid_nvidia.c,v 1.5 2022/03/19 13:51:01 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2000 - 2008 Søren Schmidt 
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata_raid_nvidia.c,v 1.4 2018/10/22 19:38:06 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_raid_nvidia.c,v 1.5 2022/03/19 13:51:01 hannken Exp $");
 
 #include 
 #include 
@@ -145,6 +145,7 @@ ata_raid_read_config_nvidia(struct wd_so
 	if (error)
 		goto out;
 
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	error = VOP_OPEN(vp, FREAD, NOCRED);
 	if (error) {
 		vput(vp);

Index: src/sys/dev/ata/ata_raid_promise.c
diff -u src/sys/dev/ata/ata_raid_promise.c:1.13 src/sys/dev/ata/ata_raid_promise.c:1.14
--- src/sys/dev/ata/ata_raid_promise.c:1.13	Mon Oct 22 19:38:06 2018
+++ src/sys/dev/ata/ata_raid_promise.c	Sat Mar 19 13:51:01 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata_raid_promise.c,v 1.13 2018/10/22 19:38:06 jdolecek Exp $	*/
+/*	$NetBSD: ata_raid_promise.c,v 1.14 2022/03/19 13:51:01 hannken Exp $	*/
 
 /*-
  * Copyright (c) 

CVS commit: src/sys/dev/ata

2022-03-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar 19 13:51:01 UTC 2022

Modified Files:
src/sys/dev/ata: ata_raid_adaptec.c ata_raid_intel.c ata_raid_jmicron.c
ata_raid_nvidia.c ata_raid_promise.c ata_raid_subr.c ata_raid_via.c

Log Message:
Lock vnode across VOP_OPEN.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ata/ata_raid_adaptec.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ata/ata_raid_intel.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ata/ata_raid_jmicron.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ata/ata_raid_nvidia.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ata/ata_raid_promise.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ata/ata_raid_subr.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ata/ata_raid_via.c

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



CVS commit: src/sys/kern

2022-03-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar 19 13:50:28 UTC 2022

Modified Files:
src/sys/kern: vfs_mount.c

Log Message:
Lock vnode across VOP_OPEN.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/kern/vfs_mount.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/kern/vfs_mount.c
diff -u src/sys/kern/vfs_mount.c:1.89 src/sys/kern/vfs_mount.c:1.90
--- src/sys/kern/vfs_mount.c:1.89	Wed Mar 16 20:31:02 2022
+++ src/sys/kern/vfs_mount.c	Sat Mar 19 13:50:28 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_mount.c,v 1.89 2022/03/16 20:31:02 andvar Exp $	*/
+/*	$NetBSD: vfs_mount.c,v 1.90 2022/03/19 13:50:28 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1997-2020 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.89 2022/03/16 20:31:02 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.90 2022/03/19 13:50:28 hannken Exp $");
 
 #include 
 #include 
@@ -1178,7 +1178,9 @@ vfs_mountroot(void)
 			panic("vfs_mountroot: rootdev not set for DV_DISK");
 	if (bdevvp(rootdev, ))
 	panic("vfs_mountroot: can't get vnode for rootdev");
+		vn_lock(rootvp, LK_EXCLUSIVE | LK_RETRY);
 		error = VOP_OPEN(rootvp, FREAD, FSCRED);
+		VOP_UNLOCK(rootvp);
 		if (error) {
 			printf("vfs_mountroot: can't open root device\n");
 			return (error);



CVS commit: src/sys/kern

2022-03-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar 19 13:50:28 UTC 2022

Modified Files:
src/sys/kern: vfs_mount.c

Log Message:
Lock vnode across VOP_OPEN.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/kern/vfs_mount.c

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



CVS commit: src/sys/kern

2022-03-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar 19 13:50:02 UTC 2022

Modified Files:
src/sys/kern: vfs_vnops.c

Log Message:
Lock vnode across VOP_OPEN.


To generate a diff of this commit:
cvs rdiff -u -r1.225 -r1.226 src/sys/kern/vfs_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/kern/vfs_vnops.c
diff -u src/sys/kern/vfs_vnops.c:1.225 src/sys/kern/vfs_vnops.c:1.226
--- src/sys/kern/vfs_vnops.c:1.225	Sun Mar 13 13:52:53 2022
+++ src/sys/kern/vfs_vnops.c	Sat Mar 19 13:50:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnops.c,v 1.225 2022/03/13 13:52:53 riastradh Exp $	*/
+/*	$NetBSD: vfs_vnops.c,v 1.226 2022/03/19 13:50:02 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.225 2022/03/13 13:52:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.226 2022/03/19 13:50:02 hannken Exp $");
 
 #include "veriexec.h"
 
@@ -1344,13 +1344,15 @@ vn_bdev_open(dev_t dev, struct vnode **v
 	if ((error = bdevvp(dev, vpp)) != 0)
 		return error;
 
+	vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
 	if ((error = VOP_OPEN(*vpp, FREAD | FWRITE, l->l_cred)) != 0) {
-		vrele(*vpp);
+		vput(*vpp);
 		return error;
 	}
 	mutex_enter((*vpp)->v_interlock);
 	(*vpp)->v_writecount++;
 	mutex_exit((*vpp)->v_interlock);
+	VOP_UNLOCK(*vpp);
 
 	return 0;
 }



CVS commit: src/sys/kern

2022-03-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar 19 13:50:02 UTC 2022

Modified Files:
src/sys/kern: vfs_vnops.c

Log Message:
Lock vnode across VOP_OPEN.


To generate a diff of this commit:
cvs rdiff -u -r1.225 -r1.226 src/sys/kern/vfs_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/arch/landisk/landisk

2022-03-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar 19 13:49:21 UTC 2022

Modified Files:
src/sys/arch/landisk/landisk: autoconf.c

Log Message:
Lock vnode across VOP_OPEN/VOP_IOCTL/VOP_CLOSE.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/landisk/landisk/autoconf.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/arch/landisk/landisk/autoconf.c
diff -u src/sys/arch/landisk/landisk/autoconf.c:1.8 src/sys/arch/landisk/landisk/autoconf.c:1.9
--- src/sys/arch/landisk/landisk/autoconf.c:1.8	Sat Apr  6 00:09:09 2019
+++ src/sys/arch/landisk/landisk/autoconf.c	Sat Mar 19 13:49:21 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.8 2019/04/06 00:09:09 uwe Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.9 2022/03/19 13:49:21 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.8 2019/04/06 00:09:09 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.9 2022/03/19 13:49:21 hannken Exp $");
 
 #include 
 #include 
@@ -107,6 +107,7 @@ match_bootdisk(device_t dv, struct btinf
 	 */
 	if (bdevvp(MAKEDISKDEV(bmajor, device_unit(dv), RAW_PART), ))
 		panic("match_bootdisk: can't alloc vnode");
+	vn_lock(tmpvn, LK_EXCLUSIVE | LK_RETRY);
 	error = VOP_OPEN(tmpvn, FREAD, NOCRED);
 	if (error) {
 #ifndef DEBUG



CVS commit: src/sys/arch/landisk/landisk

2022-03-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar 19 13:49:21 UTC 2022

Modified Files:
src/sys/arch/landisk/landisk: autoconf.c

Log Message:
Lock vnode across VOP_OPEN/VOP_IOCTL/VOP_CLOSE.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/landisk/landisk/autoconf.c

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



CVS commit: src/sys/ufs/mfs

2022-03-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar 19 13:48:42 UTC 2022

Modified Files:
src/sys/ufs/mfs: mfs_vfsops.c mfs_vnops.c

Log Message:
Switch MFS device node to real vnode locking, VV_LOCKSWORK now.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/ufs/mfs/mfs_vfsops.c
cvs rdiff -u -r1.63 -r1.64 src/sys/ufs/mfs/mfs_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/ufs/mfs/mfs_vfsops.c
diff -u src/sys/ufs/mfs/mfs_vfsops.c:1.114 src/sys/ufs/mfs/mfs_vfsops.c:1.115
--- src/sys/ufs/mfs/mfs_vfsops.c:1.114	Mon Mar 16 21:20:13 2020
+++ src/sys/ufs/mfs/mfs_vfsops.c	Sat Mar 19 13:48:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mfs_vfsops.c,v 1.114 2020/03/16 21:20:13 pgoyette Exp $	*/
+/*	$NetBSD: mfs_vfsops.c,v 1.115 2022/03/19 13:48:42 hannken Exp $	*/
 
 /*
  * Copyright (c) 1989, 1990, 1993, 1994
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.114 2020/03/16 21:20:13 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.115 2022/03/19 13:48:42 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -208,6 +208,7 @@ mfs_mountroot(void)
 	rootvp->v_data = mfsp;
 	rootvp->v_op = mfs_vnodeop_p;
 	rootvp->v_tag = VT_MFS;
+	rootvp->v_vflag |= VV_LOCKSWORK;
 	mfsp->mfs_baseoff = mfs_rootbase;
 	mfsp->mfs_size = mfs_rootsize;
 	mfsp->mfs_vnode = rootvp;
@@ -326,6 +327,7 @@ mfs_mount(struct mount *mp, const char *
 	KASSERT(devvp->v_data == NULL);
 	devvp->v_op = mfs_vnodeop_p;
 	devvp->v_data = mfsp;
+	devvp->v_vflag |= VV_LOCKSWORK;
 	mfsp->mfs_baseoff = args->base;
 	mfsp->mfs_size = args->size;
 	mfsp->mfs_vnode = devvp;

Index: src/sys/ufs/mfs/mfs_vnops.c
diff -u src/sys/ufs/mfs/mfs_vnops.c:1.63 src/sys/ufs/mfs/mfs_vnops.c:1.64
--- src/sys/ufs/mfs/mfs_vnops.c:1.63	Sun Jul 18 23:57:15 2021
+++ src/sys/ufs/mfs/mfs_vnops.c	Sat Mar 19 13:48:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mfs_vnops.c,v 1.63 2021/07/18 23:57:15 dholland Exp $	*/
+/*	$NetBSD: mfs_vnops.c,v 1.64 2022/03/19 13:48:42 hannken Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfs_vnops.c,v 1.63 2021/07/18 23:57:15 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfs_vnops.c,v 1.64 2022/03/19 13:48:42 hannken Exp $");
 
 #include 
 #include 
@@ -89,12 +89,12 @@ const struct vnodeopv_entry_desc mfs_vno
 	{ _abortop_desc, genfs_badop },		/* abortop */
 	{ _inactive_desc, mfs_inactive },		/* inactive */
 	{ _reclaim_desc, mfs_reclaim },		/* reclaim */
-	{ _lock_desc, genfs_nolock },		/* lock */
-	{ _unlock_desc, genfs_nounlock },		/* unlock */
+	{ _lock_desc, genfs_lock },			/* lock */
+	{ _unlock_desc, genfs_unlock },		/* unlock */
 	{ _bmap_desc, mfs_bmap },			/* bmap */
 	{ _strategy_desc, mfs_strategy },		/* strategy */
 	{ _print_desc, mfs_print },			/* print */
-	{ _islocked_desc, genfs_noislocked },	/* islocked */
+	{ _islocked_desc, genfs_islocked },		/* islocked */
 	{ _pathconf_desc, genfs_badop },		/* pathconf */
 	{ _advlock_desc, genfs_badop },		/* advlock */
 	{ _bwrite_desc, vn_bwrite },		/* bwrite */



CVS commit: src/sys/ufs/mfs

2022-03-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar 19 13:48:42 UTC 2022

Modified Files:
src/sys/ufs/mfs: mfs_vfsops.c mfs_vnops.c

Log Message:
Switch MFS device node to real vnode locking, VV_LOCKSWORK now.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/ufs/mfs/mfs_vfsops.c
cvs rdiff -u -r1.63 -r1.64 src/sys/ufs/mfs/mfs_vnops.c

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



<    1   2   3   4   5   >