Module Name:    src
Committed By:   hannken
Date:           Mon Apr 17 08:31:02 UTC 2017

Modified Files:
        src/sys/fs/cd9660: cd9660_vfsops.c
        src/sys/fs/filecorefs: filecore_vfsops.c
        src/sys/fs/msdosfs: msdosfs_vfsops.c
        src/sys/fs/ntfs: ntfs_vfsops.c
        src/sys/fs/puffs: puffs_msgif.c
        src/sys/fs/v7fs: v7fs_vfsops.c
        src/sys/kern: vfs_mount.c vfs_syscalls.c vfs_trans.c vfs_vnode.c
        src/sys/nfs: nfs_vfsops.c
        src/sys/sys: mount.h
        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:
Add vfs_ref(mp) and vfs_rele(mp) to add or remove a reference to
struct mount.  Rename vfs_destroy(mp) to vfs_rele(mp) and replace
incrementing mp->mnt_refcnt with vfs_ref(mp).


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/fs/cd9660/cd9660_vfsops.c
cvs rdiff -u -r1.79 -r1.80 src/sys/fs/filecorefs/filecore_vfsops.c
cvs rdiff -u -r1.125 -r1.126 src/sys/fs/msdosfs/msdosfs_vfsops.c
cvs rdiff -u -r1.105 -r1.106 src/sys/fs/ntfs/ntfs_vfsops.c
cvs rdiff -u -r1.100 -r1.101 src/sys/fs/puffs/puffs_msgif.c
cvs rdiff -u -r1.13 -r1.14 src/sys/fs/v7fs/v7fs_vfsops.c
cvs rdiff -u -r1.54 -r1.55 src/sys/kern/vfs_mount.c
cvs rdiff -u -r1.510 -r1.511 src/sys/kern/vfs_syscalls.c
cvs rdiff -u -r1.41 -r1.42 src/sys/kern/vfs_trans.c
cvs rdiff -u -r1.85 -r1.86 src/sys/kern/vfs_vnode.c
cvs rdiff -u -r1.233 -r1.234 src/sys/nfs/nfs_vfsops.c
cvs rdiff -u -r1.223 -r1.224 src/sys/sys/mount.h
cvs rdiff -u -r1.206 -r1.207 src/sys/ufs/ext2fs/ext2fs_vfsops.c
cvs rdiff -u -r1.351 -r1.352 src/sys/ufs/ffs/ffs_vfsops.c
cvs rdiff -u -r1.357 -r1.358 src/sys/ufs/lfs/lfs_vfsops.c
cvs rdiff -u -r1.111 -r1.112 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/sys/fs/cd9660/cd9660_vfsops.c
diff -u src/sys/fs/cd9660/cd9660_vfsops.c:1.91 src/sys/fs/cd9660/cd9660_vfsops.c:1.92
--- src/sys/fs/cd9660/cd9660_vfsops.c:1.91	Fri Feb 17 08:31:24 2017
+++ src/sys/fs/cd9660/cd9660_vfsops.c	Mon Apr 17 08:31:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660_vfsops.c,v 1.91 2017/02/17 08:31:24 hannken Exp $	*/
+/*	$NetBSD: cd9660_vfsops.c,v 1.92 2017/04/17 08:31:01 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1994
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.91 2017/02/17 08:31:24 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.92 2017/04/17 08:31:01 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -192,7 +192,7 @@ cd9660_mountroot(void)
 	args.flags = ISOFSMNT_ROOT;
 	if ((error = iso_mountfs(rootvp, mp, l, &args)) != 0) {
 		vfs_unbusy(mp, false, NULL);
-		vfs_destroy(mp);
+		vfs_rele(mp);
 		return (error);
 	}
 	mountlist_append(mp);

Index: src/sys/fs/filecorefs/filecore_vfsops.c
diff -u src/sys/fs/filecorefs/filecore_vfsops.c:1.79 src/sys/fs/filecorefs/filecore_vfsops.c:1.80
--- src/sys/fs/filecorefs/filecore_vfsops.c:1.79	Fri Feb 17 08:31:24 2017
+++ src/sys/fs/filecorefs/filecore_vfsops.c	Mon Apr 17 08:31:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: filecore_vfsops.c,v 1.79 2017/02/17 08:31:24 hannken Exp $	*/
+/*	$NetBSD: filecore_vfsops.c,v 1.80 2017/04/17 08:31:01 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1994 The Regents of the University of California.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: filecore_vfsops.c,v 1.79 2017/02/17 08:31:24 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filecore_vfsops.c,v 1.80 2017/04/17 08:31:01 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -202,7 +202,7 @@ filecore_mountroot(void)
 	args.flags = FILECOREMNT_ROOT;
 	if ((error = filecore_mountfs(rootvp, mp, p, &args)) != 0) {
 		vfs_unbusy(mp, false, NULL);
-		vfs_destroy(mp);
+		vfs_rele(mp);
 		return (error);
 	}
 	mountlist_append(mp);

Index: src/sys/fs/msdosfs/msdosfs_vfsops.c
diff -u src/sys/fs/msdosfs/msdosfs_vfsops.c:1.125 src/sys/fs/msdosfs/msdosfs_vfsops.c:1.126
--- src/sys/fs/msdosfs/msdosfs_vfsops.c:1.125	Sat Apr  1 19:35:56 2017
+++ src/sys/fs/msdosfs/msdosfs_vfsops.c	Mon Apr 17 08:31:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vfsops.c,v 1.125 2017/04/01 19:35:56 riastradh Exp $	*/
+/*	$NetBSD: msdosfs_vfsops.c,v 1.126 2017/04/17 08:31:01 hannken Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.125 2017/04/01 19:35:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.126 2017/04/17 08:31:01 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -248,14 +248,14 @@ msdosfs_mountroot(void)
 
 	if ((error = msdosfs_mountfs(rootvp, mp, l, &args)) != 0) {
 		vfs_unbusy(mp, false, NULL);
-		vfs_destroy(mp);
+		vfs_rele(mp);
 		return (error);
 	}
 
 	if ((error = update_mp(mp, &args)) != 0) {
 		(void)msdosfs_unmount(mp, 0);
 		vfs_unbusy(mp, false, NULL);
-		vfs_destroy(mp);
+		vfs_rele(mp);
 		vrele(rootvp);
 		return (error);
 	}

Index: src/sys/fs/ntfs/ntfs_vfsops.c
diff -u src/sys/fs/ntfs/ntfs_vfsops.c:1.105 src/sys/fs/ntfs/ntfs_vfsops.c:1.106
--- src/sys/fs/ntfs/ntfs_vfsops.c:1.105	Fri Feb 17 08:31:24 2017
+++ src/sys/fs/ntfs/ntfs_vfsops.c	Mon Apr 17 08:31:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntfs_vfsops.c,v 1.105 2017/02/17 08:31:24 hannken Exp $	*/
+/*	$NetBSD: ntfs_vfsops.c,v 1.106 2017/04/17 08:31:01 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999 Semen Ustimenko
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.105 2017/02/17 08:31:24 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.106 2017/04/17 08:31:01 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -116,7 +116,7 @@ ntfs_mountroot(void)
 
 	if ((error = ntfs_mountfs(rootvp, mp, &args, l)) != 0) {
 		vfs_unbusy(mp, false, NULL);
-		vfs_destroy(mp);
+		vfs_rele(mp);
 		return (error);
 	}
 

Index: src/sys/fs/puffs/puffs_msgif.c
diff -u src/sys/fs/puffs/puffs_msgif.c:1.100 src/sys/fs/puffs/puffs_msgif.c:1.101
--- src/sys/fs/puffs/puffs_msgif.c:1.100	Mon Dec 26 08:21:09 2016
+++ src/sys/fs/puffs/puffs_msgif.c	Mon Apr 17 08:31:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_msgif.c,v 1.100 2016/12/26 08:21:09 skrll Exp $	*/
+/*	$NetBSD: puffs_msgif.c,v 1.101 2017/04/17 08:31:01 hannken Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_msgif.c,v 1.100 2016/12/26 08:21:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_msgif.c,v 1.101 2017/04/17 08:31:01 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -1097,7 +1097,7 @@ puffs_sop_thread(void *arg)
 			 * We know the mountpoint is still alive because
 			 * the thread that is us (poetic?) is still alive.
 			 */
-			atomic_inc_uint((unsigned int*)&mp->mnt_refcnt);
+			vfs_ref(mp);
 			break;
 		}
 
@@ -1137,7 +1137,7 @@ puffs_sop_thread(void *arg)
 	 */
 	if (unmountme) {
 		(void)dounmount(mp, MNT_FORCE, curlwp);
-		vfs_destroy(mp);
+		vfs_rele(mp);
 	}
 
 	kthread_exit(0);
@@ -1182,13 +1182,13 @@ puffs_msgif_close(void *ctx)
 	}
 
 	/* Won't access pmp from here anymore */
-	atomic_inc_uint((unsigned int*)&mp->mnt_refcnt);
+	vfs_ref(mp);
 	puffs_mp_release(pmp);
 	mutex_exit(&pmp->pmp_lock);
 
 	/* Detach from VFS. */
 	(void)dounmount(mp, MNT_FORCE, curlwp);
-	vfs_destroy(mp);
+	vfs_rele(mp);
 
 	return 0;
 }

Index: src/sys/fs/v7fs/v7fs_vfsops.c
diff -u src/sys/fs/v7fs/v7fs_vfsops.c:1.13 src/sys/fs/v7fs/v7fs_vfsops.c:1.14
--- src/sys/fs/v7fs/v7fs_vfsops.c:1.13	Sat Apr  1 19:35:57 2017
+++ src/sys/fs/v7fs/v7fs_vfsops.c	Mon Apr 17 08:31:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_vfsops.c,v 1.13 2017/04/01 19:35:57 riastradh Exp $	*/
+/*	$NetBSD: v7fs_vfsops.c,v 1.14 2017/04/17 08:31:02 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: v7fs_vfsops.c,v 1.13 2017/04/01 19:35:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: v7fs_vfsops.c,v 1.14 2017/04/17 08:31:02 hannken Exp $");
 #if defined _KERNEL_OPT
 #include "opt_v7fs.h"
 #endif
@@ -580,7 +580,7 @@ v7fs_mountroot(void)
 	if ((error = v7fs_mountfs(rootvp, mp, _BYTE_ORDER))) {
 		DPRINTF("mountfs error=%d\n", error);
 		vfs_unbusy(mp, false, NULL);
-		vfs_destroy(mp);
+		vfs_rele(mp);
 		return error;
 	}
 

Index: src/sys/kern/vfs_mount.c
diff -u src/sys/kern/vfs_mount.c:1.54 src/sys/kern/vfs_mount.c:1.55
--- src/sys/kern/vfs_mount.c:1.54	Mon Apr 17 08:29:58 2017
+++ src/sys/kern/vfs_mount.c	Mon Apr 17 08:31:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_mount.c,v 1.54 2017/04/17 08:29:58 hannken Exp $	*/
+/*	$NetBSD: vfs_mount.c,v 1.55 2017/04/17 08:31:02 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.54 2017/04/17 08:29:58 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.55 2017/04/17 08:31:02 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -264,10 +264,22 @@ vfs_getvfs(fsid_t *fsid)
 }
 
 /*
+ * Take a reference to a mount structure.
+ */
+void
+vfs_ref(struct mount *mp)
+{
+
+	KASSERT(mp->mnt_refcnt > 0 || mutex_owned(&mountlist_lock));
+
+	atomic_inc_uint(&mp->mnt_refcnt);
+}
+
+/*
  * Drop a reference to a mount structure, freeing if the last reference.
  */
 void
-vfs_destroy(struct mount *mp)
+vfs_rele(struct mount *mp)
 {
 
 	if (__predict_true((int)atomic_dec_uint_nv(&mp->mnt_refcnt) > 0)) {
@@ -315,7 +327,7 @@ vfs_busy(struct mount *mp, struct mount 
 	++mp->mnt_busynest;
 	KASSERT(mp->mnt_busynest != 0);
 	mutex_exit(&mp->mnt_unmounting);
-	atomic_inc_uint(&mp->mnt_refcnt);
+	vfs_ref(mp);
 	return 0;
 }
 
@@ -340,7 +352,7 @@ vfs_unbusy(struct mount *mp, bool keepre
 	mp->mnt_busynest--;
 	mutex_exit(&mp->mnt_unmounting);
 	if (!keepref) {
-		vfs_destroy(mp);
+		vfs_rele(mp);
 	}
 }
 
@@ -460,7 +472,7 @@ vfs_insmntque(vnode_t *vp, struct mount 
 
 	if (omp != NULL) {
 		/* Release reference to old mount. */
-		vfs_destroy(omp);
+		vfs_rele(omp);
 	}
 }
 
@@ -716,7 +728,7 @@ mount_domount(struct lwp *l, vnode_t **v
 
 	if ((error = fstrans_mount(mp)) != 0) {
 		vfs_unbusy(mp, false, NULL);
-		vfs_destroy(mp);
+		vfs_rele(mp);
 		return error;
 	}
 
@@ -791,7 +803,7 @@ mount_domount(struct lwp *l, vnode_t **v
 		(void)start_extattr(mp);
 	}
 	/* Drop reference held for VFS_START(). */
-	vfs_destroy(mp);
+	vfs_rele(mp);
 	*vpp = NULL;
 	return error;
 
@@ -804,7 +816,7 @@ err_unmounted:
 	mutex_exit(&mp->mnt_updating);
 	fstrans_unmount(mp);
 	vfs_unbusy(mp, false, NULL);
-	vfs_destroy(mp);
+	vfs_rele(mp);
 
 	return error;
 }
@@ -941,7 +953,7 @@ dounmount(struct mount *mp, int flags, s
 	vfs_hooks_unmount(mp);
 
 	fstrans_unmount(mp);
-	vfs_destroy(mp);	/* reference from mount() */
+	vfs_rele(mp);	/* reference from mount() */
 	if (coveredvp != NULLVP) {
 		vrele(coveredvp);
 	}
@@ -986,9 +998,9 @@ vfs_unmount_next(uint64_t gen)
 		if ((nmp == NULL || mp->mnt_gen > nmp->mnt_gen) && 
 		    mp->mnt_gen < gen) {
 			if (nmp != NULL)
-				vfs_destroy(nmp);
+				vfs_rele(nmp);
 			nmp = mp;
-			atomic_inc_uint(&nmp->mnt_refcnt);
+			vfs_ref(nmp);
 		}
 	}
 	mountlist_iterator_destroy(iter);
@@ -1015,7 +1027,7 @@ vfs_unmount_forceone(struct lwp *l)
 		vfs_unmount_print(mp, "forcefully ");
 		return true;
 	} else {
-		vfs_destroy(mp);
+		vfs_rele(mp);
 	}
 
 #ifdef DEBUG
@@ -1050,7 +1062,7 @@ vfs_unmountall1(struct lwp *l, bool forc
 			vfs_unmount_print(mp, "");
 			progress = true;
 		} else {
-			vfs_destroy(mp);
+			vfs_rele(mp);
 			if (verbose) {
 				printf("unmount of %s failed with error %d\n",
 				    mp->mnt_stat.f_mntonname, error);
@@ -1551,16 +1563,16 @@ mountlist_iterator_next(mount_iterator_t
 		/* Take an initial reference for vfs_busy() below. */
 		mp = me->me_mount;
 		KASSERT(mp != NULL);
-		atomic_inc_uint(&mp->mnt_refcnt);
+		vfs_ref(mp);
 		mutex_exit(&mountlist_lock);
 
 		/* Try to mark this mount busy and return on success. */
 		if (vfs_busy(mp, NULL) == 0) {
-			vfs_destroy(mp);
+			vfs_rele(mp);
 			marker->me_mount = mp;
 			return mp;
 		}
-		vfs_destroy(mp);
+		vfs_rele(mp);
 		mutex_enter(&mountlist_lock);
 	}
 }

Index: src/sys/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.510 src/sys/kern/vfs_syscalls.c:1.511
--- src/sys/kern/vfs_syscalls.c:1.510	Wed Apr 12 10:28:39 2017
+++ src/sys/kern/vfs_syscalls.c	Mon Apr 17 08:31:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.510 2017/04/12 10:28:39 hannken Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.511 2017/04/17 08:31:02 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.510 2017/04/12 10:28:39 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.511 2017/04/17 08:31:02 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -595,14 +595,14 @@ sys_unmount(struct lwp *l, const struct 
 	pathbuf_destroy(pb);
 
 	mp = vp->v_mount;
-	atomic_inc_uint(&mp->mnt_refcnt);
+	vfs_ref(mp);
 	VOP_UNLOCK(vp);
 
 	error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_MOUNT,
 	    KAUTH_REQ_SYSTEM_MOUNT_UNMOUNT, mp, NULL, NULL);
 	if (error) {
 		vrele(vp);
-		vfs_destroy(mp);
+		vfs_rele(mp);
 		return (error);
 	}
 
@@ -611,7 +611,7 @@ sys_unmount(struct lwp *l, const struct 
 	 */
 	if (mp->mnt_flag & MNT_ROOTFS) {
 		vrele(vp);
-		vfs_destroy(mp);
+		vfs_rele(mp);
 		return (EINVAL);
 	}
 
@@ -620,13 +620,13 @@ sys_unmount(struct lwp *l, const struct 
 	 */
 	if ((vp->v_vflag & VV_ROOT) == 0) {
 		vrele(vp);
-		vfs_destroy(mp);
+		vfs_rele(mp);
 		return (EINVAL);
 	}
 
 	vrele(vp);
 	error = dounmount(mp, SCARG(uap, flags), l);
-	vfs_destroy(mp);
+	vfs_rele(mp);
 	return error;
 }
 

Index: src/sys/kern/vfs_trans.c
diff -u src/sys/kern/vfs_trans.c:1.41 src/sys/kern/vfs_trans.c:1.42
--- src/sys/kern/vfs_trans.c:1.41	Wed Apr 12 10:23:35 2017
+++ src/sys/kern/vfs_trans.c	Mon Apr 17 08:31:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_trans.c,v 1.41 2017/04/12 10:23:35 hannken Exp $	*/
+/*	$NetBSD: vfs_trans.c,v 1.42 2017/04/17 08:31:02 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.41 2017/04/12 10:23:35 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.42 2017/04/17 08:31:02 hannken Exp $");
 
 /*
  * File system transaction operations.
@@ -179,7 +179,7 @@ fstrans_mount_dtor(struct mount *mp)
 	mutex_exit(&fstrans_mount_lock);
 
 	kmem_free(fmi, sizeof(*fmi));
-	vfs_destroy(mp);
+	vfs_rele(mp);
 }
 
 /*

Index: src/sys/kern/vfs_vnode.c
diff -u src/sys/kern/vfs_vnode.c:1.85 src/sys/kern/vfs_vnode.c:1.86
--- src/sys/kern/vfs_vnode.c:1.85	Sun Apr 16 16:48:08 2017
+++ src/sys/kern/vfs_vnode.c	Mon Apr 17 08:31:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnode.c,v 1.85 2017/04/16 16:48:08 riastradh Exp $	*/
+/*	$NetBSD: vfs_vnode.c,v 1.86 2017/04/17 08:31:02 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -156,7 +156,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.85 2017/04/16 16:48:08 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.86 2017/04/17 08:31:02 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -1595,7 +1595,7 @@ vcache_reclaim(vnode_t *vp)
 	 * operations vector.  See sys/kern/vnode_if.c.
 	 */
 	vp->v_vflag &= ~VV_ROOT;
-	atomic_inc_uint(&dead_rootmount->mnt_refcnt);
+	vfs_ref(dead_rootmount);
 	vfs_insmntque(vp, dead_rootmount);
 
 	mutex_enter(vp->v_interlock);

Index: src/sys/nfs/nfs_vfsops.c
diff -u src/sys/nfs/nfs_vfsops.c:1.233 src/sys/nfs/nfs_vfsops.c:1.234
--- src/sys/nfs/nfs_vfsops.c:1.233	Sat Apr  1 19:35:57 2017
+++ src/sys/nfs/nfs_vfsops.c	Mon Apr 17 08:31:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_vfsops.c,v 1.233 2017/04/01 19:35:57 riastradh Exp $	*/
+/*	$NetBSD: nfs_vfsops.c,v 1.234 2017/04/17 08:31:02 hannken Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.233 2017/04/01 19:35:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.234 2017/04/17 08:31:02 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_nfs.h"
@@ -436,7 +436,7 @@ nfs_mount_diskless(struct nfs_dlmount *n
 			 ndmntp->ndm_args.hostname, vpp, l);
 	if (error) {
 		vfs_unbusy(mp, false, NULL);
-		vfs_destroy(mp);
+		vfs_rele(mp);
 		printf("nfs_mountroot: mount %s failed: %d\n",
 		       mntname, error);
 	} else

Index: src/sys/sys/mount.h
diff -u src/sys/sys/mount.h:1.223 src/sys/sys/mount.h:1.224
--- src/sys/sys/mount.h:1.223	Mon Apr 17 08:29:58 2017
+++ src/sys/sys/mount.h	Mon Apr 17 08:31:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mount.h,v 1.223 2017/04/17 08:29:58 hannken Exp $	*/
+/*	$NetBSD: mount.h,v 1.224 2017/04/17 08:31:02 hannken Exp $	*/
 
 /*
  * Copyright (c) 1989, 1991, 1993
@@ -424,7 +424,8 @@ int	vfs_detach(struct vfsops *);
 void	vfs_reinit(void);
 struct vfsops *vfs_getopsbyname(const char *);
 void	vfs_delref(struct vfsops *);
-void	vfs_destroy(struct mount *);
+void	vfs_ref(struct mount *);
+void	vfs_rele(struct mount *);
 struct mount *vfs_mountalloc(struct vfsops *, struct vnode *);
 int	vfs_stdextattrctl(struct mount *, int, struct vnode *,
 	    int, const char *);

Index: src/sys/ufs/ext2fs/ext2fs_vfsops.c
diff -u src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.206 src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.207
--- src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.206	Sat Apr  1 19:35:57 2017
+++ src/sys/ufs/ext2fs/ext2fs_vfsops.c	Mon Apr 17 08:31:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ext2fs_vfsops.c,v 1.206 2017/04/01 19:35:57 riastradh Exp $	*/
+/*	$NetBSD: ext2fs_vfsops.c,v 1.207 2017/04/17 08:31:02 hannken Exp $	*/
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1994
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.206 2017/04/01 19:35:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.207 2017/04/17 08:31:02 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -280,7 +280,7 @@ ext2fs_mountroot(void)
 
 	if ((error = ext2fs_mountfs(rootvp, mp)) != 0) {
 		vfs_unbusy(mp, false, NULL);
-		vfs_destroy(mp);
+		vfs_rele(mp);
 		return error;
 	}
 	mountlist_append(mp);

Index: src/sys/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.351 src/sys/ufs/ffs/ffs_vfsops.c:1.352
--- src/sys/ufs/ffs/ffs_vfsops.c:1.351	Sat Apr  1 19:35:56 2017
+++ src/sys/ufs/ffs/ffs_vfsops.c	Mon Apr 17 08:31:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vfsops.c,v 1.351 2017/04/01 19:35:56 riastradh Exp $	*/
+/*	$NetBSD: ffs_vfsops.c,v 1.352 2017/04/17 08:31:02 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.351 2017/04/01 19:35:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.352 2017/04/17 08:31:02 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -378,7 +378,7 @@ ffs_mountroot(void)
 	mp->mnt_flag |= MNT_FORCE;
 	if ((error = ffs_mountfs(rootvp, mp, l)) != 0) {
 		vfs_unbusy(mp, false, NULL);
-		vfs_destroy(mp);
+		vfs_rele(mp);
 		return (error);
 	}
 	mp->mnt_flag &= ~MNT_FORCE;

Index: src/sys/ufs/lfs/lfs_vfsops.c
diff -u src/sys/ufs/lfs/lfs_vfsops.c:1.357 src/sys/ufs/lfs/lfs_vfsops.c:1.358
--- src/sys/ufs/lfs/lfs_vfsops.c:1.357	Thu Apr 13 09:57:28 2017
+++ src/sys/ufs/lfs/lfs_vfsops.c	Mon Apr 17 08:31:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_vfsops.c,v 1.357 2017/04/13 09:57:28 hannken Exp $	*/
+/*	$NetBSD: lfs_vfsops.c,v 1.358 2017/04/17 08:31:02 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.357 2017/04/13 09:57:28 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.358 2017/04/17 08:31:02 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_lfs.h"
@@ -596,7 +596,7 @@ lfs_mountroot(void)
 	}
 	if ((error = lfs_mountfs(rootvp, mp, l))) {
 		vfs_unbusy(mp, false, NULL);
-		vfs_destroy(mp);
+		vfs_rele(mp);
 		return (error);
 	}
 	mountlist_append(mp);

Index: src/sys/ufs/mfs/mfs_vfsops.c
diff -u src/sys/ufs/mfs/mfs_vfsops.c:1.111 src/sys/ufs/mfs/mfs_vfsops.c:1.112
--- src/sys/ufs/mfs/mfs_vfsops.c:1.111	Fri Feb 17 08:31:26 2017
+++ src/sys/ufs/mfs/mfs_vfsops.c	Mon Apr 17 08:31:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mfs_vfsops.c,v 1.111 2017/02/17 08:31:26 hannken Exp $	*/
+/*	$NetBSD: mfs_vfsops.c,v 1.112 2017/04/17 08:31:02 hannken Exp $	*/
 
 /*
  * Copyright (c) 1989, 1990, 1993, 1994
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.111 2017/02/17 08:31:26 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.112 2017/04/17 08:31:02 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -217,7 +217,7 @@ mfs_mountroot(void)
 	if ((error = ffs_mountfs(rootvp, mp, l)) != 0) {
 		vfs_unbusy(mp, false, NULL);
 		bufq_free(mfsp->mfs_buflist);
-		vfs_destroy(mp);
+		vfs_rele(mp);
 		kmem_free(mfsp, sizeof(*mfsp));
 		return (error);
 	}

Reply via email to