Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Move fstrans initialization to vfs_mountalloc().
details: https://anonhg.NetBSD.org/src/rev/668069b7f3f0
branches: trunk
changeset: 353450:668069b7f3f0
user: hannken <hannken%NetBSD.org@localhost>
date: Sun May 07 08:24:20 2017 +0000
description:
Move fstrans initialization to vfs_mountalloc().
diffstat:
sys/kern/vfs_mount.c | 17 ++++++++---------
sys/kern/vfs_trans.c | 9 ++-------
2 files changed, 10 insertions(+), 16 deletions(-)
diffs (98 lines):
diff -r 8e53fd6ae461 -r 668069b7f3f0 sys/kern/vfs_mount.c
--- a/sys/kern/vfs_mount.c Sun May 07 08:23:28 2017 +0000
+++ b/sys/kern/vfs_mount.c Sun May 07 08:24:20 2017 +0000
@@ -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 @@
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 @@
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 @@
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 @@
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
diff -r 8e53fd6ae461 -r 668069b7f3f0 sys/kern/vfs_trans.c
--- a/sys/kern/vfs_trans.c Sun May 07 08:23:28 2017 +0000
+++ b/sys/kern/vfs_trans.c Sun May 07 08:24:20 2017 +0000
@@ -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 @@
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 @@
mutex_exit(&fstrans_mount_lock);
vfs_ref(mp);
- vfs_unbusy(mp);
return 0;
}
Home |
Main Index |
Thread Index |
Old Index