Module Name: src
Committed By: hannken
Date: Sun May 7 08:24:20 UTC 2017
Modified Files:
src/sys/kern: vfs_mount.c vfs_trans.c
Log Message:
Move fstrans initialization to vfs_mountalloc().
To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/kern/vfs_mount.c
cvs rdiff -u -r1.44 -r1.45 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_mount.c
diff -u src/sys/kern/vfs_mount.c:1.59 src/sys/kern/vfs_mount.c:1.60
--- src/sys/kern/vfs_mount.c:1.59 Sun May 7 08:21:08 2017
+++ src/sys/kern/vfs_mount.c Sun May 7 08:24:20 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_mount.c,v 1.59 2017/05/07 08:21:08 hannken Exp $ */
+/* $NetBSD: vfs_mount.c,v 1.60 2017/05/07 08:24:20 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.59 2017/05/07 08:21:08 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.60 2017/05/07 08:24:20 hannken Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -148,6 +148,8 @@ struct mount *
vfs_mountalloc(struct vfsops *vfsops, vnode_t *vp)
{
struct mount *mp;
+ int error __diagused;
+ extern struct vfsops dead_vfsops;
mp = kmem_zalloc(sizeof(*mp), KM_SLEEP);
if (mp == NULL)
@@ -161,6 +163,10 @@ vfs_mountalloc(struct vfsops *vfsops, vn
mutex_init(&mp->mnt_updating, MUTEX_DEFAULT, IPL_NONE);
mp->mnt_vnodecovered = vp;
mount_initspecific(mp);
+ if (vfsops != &dead_vfsops) {
+ error = fstrans_mount(mp);
+ KASSERT(error == 0);
+ }
mutex_enter(&mountgen_lock);
mp->mnt_gen = mountgen++;
@@ -735,11 +741,6 @@ mount_domount(struct lwp *l, vnode_t **v
return ENOMEM;
}
- if ((error = fstrans_mount(mp)) != 0) {
- vfs_rele(mp);
- return error;
- }
-
mp->mnt_stat.f_owner = kauth_cred_geteuid(l->l_cred);
/*
@@ -1271,8 +1272,6 @@ done:
mp->mnt_flag |= MNT_ROOTFS;
mp->mnt_op->vfs_refcount++;
- error = fstrans_mount(mp);
- KASSERT(error == 0);
/*
* Get the vnode for '/'. Set cwdi0.cwdi_cdir to
Index: src/sys/kern/vfs_trans.c
diff -u src/sys/kern/vfs_trans.c:1.44 src/sys/kern/vfs_trans.c:1.45
--- src/sys/kern/vfs_trans.c:1.44 Sun May 7 08:23:28 2017
+++ src/sys/kern/vfs_trans.c Sun May 7 08:24:20 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_trans.c,v 1.44 2017/05/07 08:23:28 hannken Exp $ */
+/* $NetBSD: vfs_trans.c,v 1.45 2017/05/07 08:24:20 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.44 2017/05/07 08:23:28 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.45 2017/05/07 08:24:20 hannken Exp $");
/*
* File system transaction operations.
@@ -188,12 +188,8 @@ fstrans_mount_dtor(struct mount *mp)
int
fstrans_mount(struct mount *mp)
{
- int error;
struct fstrans_mount_info *newfmi;
- error = vfs_busy(mp);
- if (error)
- return error;
newfmi = kmem_alloc(sizeof(*newfmi), KM_SLEEP);
newfmi->fmi_state = FSTRANS_NORMAL;
newfmi->fmi_ref_cnt = 1;
@@ -206,7 +202,6 @@ fstrans_mount(struct mount *mp)
mutex_exit(&fstrans_mount_lock);
vfs_ref(mp);
- vfs_unbusy(mp);
return 0;
}