Make mntvnode_lock per-mount, and address false sharing of struct mount.
This commit is contained in:
parent
060b393c80
commit
7d06f3305f
external/cddl/osnet/dist/uts/common/fs/zfs
sys
kern
miscfs/genfs
nfs
sys
ufs
@ -1329,7 +1329,7 @@ sfs_snapshot_mount(vnode_t *vp, const char *snapname)
|
||||
vfsp->mnt_stat.f_owner = 0;
|
||||
vfsp->mnt_flag = MNT_RDONLY | MNT_NOSUID | MNT_IGNORE;
|
||||
|
||||
mutex_enter(&vfsp->mnt_updating);
|
||||
mutex_enter(vfsp->mnt_updating);
|
||||
|
||||
error = zfs_domount(vfsp, osname);
|
||||
if (error)
|
||||
@ -1349,12 +1349,12 @@ sfs_snapshot_mount(vnode_t *vp, const char *snapname)
|
||||
vref(vp);
|
||||
vp->v_mountedhere = vfsp;
|
||||
|
||||
mutex_exit(&vfsp->mnt_updating);
|
||||
mutex_exit(vfsp->mnt_updating);
|
||||
(void) VFS_STATVFS(vfsp, &vfsp->mnt_stat);
|
||||
|
||||
out:;
|
||||
if (error && vfsp) {
|
||||
mutex_exit(&vfsp->mnt_updating);
|
||||
mutex_exit(vfsp->mnt_updating);
|
||||
vfs_rele(vfsp);
|
||||
}
|
||||
PNBUF_PUT(osname);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: vfs_mount.c,v 1.72 2019/11/16 10:07:53 maxv Exp $ */
|
||||
/* $NetBSD: vfs_mount.c,v 1.73 2019/12/22 19:47:34 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 1997-2019 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
@ -67,7 +67,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.72 2019/11/16 10:07:53 maxv Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.73 2019/12/22 19:47:34 ad Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
@ -116,17 +116,16 @@ vnode_t * rootvnode;
|
||||
|
||||
/* Mounted filesystem list. */
|
||||
static TAILQ_HEAD(mountlist, mountlist_entry) mountlist;
|
||||
static kmutex_t mountlist_lock;
|
||||
static kmutex_t mountlist_lock __cacheline_aligned;
|
||||
int vnode_offset_next_by_lru /* XXX: ugly hack for pstat.c */
|
||||
= offsetof(vnode_impl_t, vi_lrulist.tqe_next);
|
||||
|
||||
kmutex_t mntvnode_lock;
|
||||
kmutex_t vfs_list_lock;
|
||||
kmutex_t vfs_list_lock __cacheline_aligned;
|
||||
|
||||
static specificdata_domain_t mount_specificdata_domain;
|
||||
static kmutex_t mntid_lock;
|
||||
|
||||
static kmutex_t mountgen_lock;
|
||||
static kmutex_t mountgen_lock __cacheline_aligned;
|
||||
static uint64_t mountgen;
|
||||
|
||||
void
|
||||
@ -135,7 +134,6 @@ vfs_mount_sysinit(void)
|
||||
|
||||
TAILQ_INIT(&mountlist);
|
||||
mutex_init(&mountlist_lock, MUTEX_DEFAULT, IPL_NONE);
|
||||
mutex_init(&mntvnode_lock, MUTEX_DEFAULT, IPL_NONE);
|
||||
mutex_init(&vfs_list_lock, MUTEX_DEFAULT, IPL_NONE);
|
||||
|
||||
mount_specificdata_domain = specificdata_domain_create();
|
||||
@ -154,8 +152,9 @@ vfs_mountalloc(struct vfsops *vfsops, vnode_t *vp)
|
||||
mp->mnt_op = vfsops;
|
||||
mp->mnt_refcnt = 1;
|
||||
TAILQ_INIT(&mp->mnt_vnodelist);
|
||||
mutex_init(&mp->mnt_renamelock, MUTEX_DEFAULT, IPL_NONE);
|
||||
mutex_init(&mp->mnt_updating, MUTEX_DEFAULT, IPL_NONE);
|
||||
mp->mnt_renamelock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
|
||||
mp->mnt_vnodelock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
|
||||
mp->mnt_updating = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
|
||||
mp->mnt_vnodecovered = vp;
|
||||
mount_initspecific(mp);
|
||||
|
||||
@ -292,8 +291,9 @@ vfs_rele(struct mount *mp)
|
||||
*/
|
||||
KASSERT(mp->mnt_refcnt == 0);
|
||||
specificdata_fini(mount_specificdata_domain, &mp->mnt_specdataref);
|
||||
mutex_destroy(&mp->mnt_updating);
|
||||
mutex_destroy(&mp->mnt_renamelock);
|
||||
mutex_obj_free(mp->mnt_updating);
|
||||
mutex_obj_free(mp->mnt_renamelock);
|
||||
mutex_obj_free(mp->mnt_vnodelock);
|
||||
if (mp->mnt_op != NULL) {
|
||||
vfs_delref(mp->mnt_op);
|
||||
}
|
||||
@ -378,10 +378,10 @@ vfs_vnode_iterator_init(struct mount *mp, struct vnode_iterator **vnip)
|
||||
vp = vnalloc_marker(mp);
|
||||
vip = VNODE_TO_VIMPL(vp);
|
||||
|
||||
mutex_enter(&mntvnode_lock);
|
||||
mutex_enter(mp->mnt_vnodelock);
|
||||
TAILQ_INSERT_HEAD(&mp->mnt_vnodelist, vip, vi_mntvnodes);
|
||||
vp->v_usecount = 1;
|
||||
mutex_exit(&mntvnode_lock);
|
||||
mutex_exit(mp->mnt_vnodelock);
|
||||
|
||||
*vnip = (struct vnode_iterator *)vip;
|
||||
}
|
||||
@ -391,14 +391,16 @@ vfs_vnode_iterator_destroy(struct vnode_iterator *vni)
|
||||
{
|
||||
vnode_impl_t *mvip = &vni->vi_vnode;
|
||||
vnode_t *mvp = VIMPL_TO_VNODE(mvip);
|
||||
kmutex_t *lock;
|
||||
|
||||
mutex_enter(&mntvnode_lock);
|
||||
KASSERT(vnis_marker(mvp));
|
||||
if (mvp->v_usecount != 0) {
|
||||
lock = mvp->v_mount->mnt_vnodelock;
|
||||
mutex_enter(lock);
|
||||
TAILQ_REMOVE(&mvp->v_mount->mnt_vnodelist, mvip, vi_mntvnodes);
|
||||
mvp->v_usecount = 0;
|
||||
mutex_exit(lock);
|
||||
}
|
||||
mutex_exit(&mntvnode_lock);
|
||||
vnfree_marker(mvp);
|
||||
}
|
||||
|
||||
@ -410,18 +412,20 @@ vfs_vnode_iterator_next1(struct vnode_iterator *vni,
|
||||
struct mount *mp = VIMPL_TO_VNODE(mvip)->v_mount;
|
||||
vnode_t *vp;
|
||||
vnode_impl_t *vip;
|
||||
kmutex_t *lock;
|
||||
int error;
|
||||
|
||||
KASSERT(vnis_marker(VIMPL_TO_VNODE(mvip)));
|
||||
|
||||
lock = mp->mnt_vnodelock;
|
||||
do {
|
||||
mutex_enter(&mntvnode_lock);
|
||||
mutex_enter(lock);
|
||||
vip = TAILQ_NEXT(mvip, vi_mntvnodes);
|
||||
TAILQ_REMOVE(&mp->mnt_vnodelist, mvip, vi_mntvnodes);
|
||||
VIMPL_TO_VNODE(mvip)->v_usecount = 0;
|
||||
again:
|
||||
if (vip == NULL) {
|
||||
mutex_exit(&mntvnode_lock);
|
||||
mutex_exit(lock);
|
||||
return NULL;
|
||||
}
|
||||
vp = VIMPL_TO_VNODE(vip);
|
||||
@ -437,7 +441,7 @@ again:
|
||||
|
||||
TAILQ_INSERT_AFTER(&mp->mnt_vnodelist, vip, mvip, vi_mntvnodes);
|
||||
VIMPL_TO_VNODE(mvip)->v_usecount = 1;
|
||||
mutex_exit(&mntvnode_lock);
|
||||
mutex_exit(lock);
|
||||
error = vcache_vget(vp);
|
||||
KASSERT(error == 0 || error == ENOENT);
|
||||
} while (error != 0);
|
||||
@ -461,24 +465,32 @@ vfs_insmntque(vnode_t *vp, struct mount *mp)
|
||||
{
|
||||
vnode_impl_t *vip = VNODE_TO_VIMPL(vp);
|
||||
struct mount *omp;
|
||||
kmutex_t *lock;
|
||||
|
||||
KASSERT(mp == NULL || (mp->mnt_iflag & IMNT_UNMOUNT) == 0 ||
|
||||
vp->v_tag == VT_VFS);
|
||||
|
||||
mutex_enter(&mntvnode_lock);
|
||||
/*
|
||||
* Delete from old mount point vnode list, if on one.
|
||||
*/
|
||||
if ((omp = vp->v_mount) != NULL)
|
||||
if ((omp = vp->v_mount) != NULL) {
|
||||
lock = omp->mnt_vnodelock;
|
||||
mutex_enter(lock);
|
||||
TAILQ_REMOVE(&vp->v_mount->mnt_vnodelist, vip, vi_mntvnodes);
|
||||
mutex_exit(lock);
|
||||
}
|
||||
|
||||
/*
|
||||
* Insert into list of vnodes for the new mount point, if
|
||||
* available. The caller must take a reference on the mount
|
||||
* structure and donate to the vnode.
|
||||
*/
|
||||
if ((vp->v_mount = mp) != NULL)
|
||||
if ((vp->v_mount = mp) != NULL) {
|
||||
lock = mp->mnt_vnodelock;
|
||||
mutex_enter(lock);
|
||||
TAILQ_INSERT_TAIL(&mp->mnt_vnodelist, vip, vi_mntvnodes);
|
||||
mutex_exit(&mntvnode_lock);
|
||||
mutex_exit(lock);
|
||||
}
|
||||
|
||||
if (omp != NULL) {
|
||||
/* Release reference to old mount. */
|
||||
@ -753,7 +765,7 @@ mount_domount(struct lwp *l, vnode_t **vpp, struct vfsops *vfsops,
|
||||
*/
|
||||
mp->mnt_flag = flags & (MNT_BASIC_FLAGS | MNT_FORCE | MNT_IGNORE);
|
||||
|
||||
mutex_enter(&mp->mnt_updating);
|
||||
mutex_enter(mp->mnt_updating);
|
||||
error = VFS_MOUNT(mp, path, data, data_len);
|
||||
mp->mnt_flag &= ~MNT_OP_FLAGS;
|
||||
|
||||
@ -802,7 +814,7 @@ mount_domount(struct lwp *l, vnode_t **vpp, struct vfsops *vfsops,
|
||||
vput(nd.ni_vp);
|
||||
|
||||
mount_checkdirs(vp);
|
||||
mutex_exit(&mp->mnt_updating);
|
||||
mutex_exit(mp->mnt_updating);
|
||||
|
||||
/* Hold an additional reference to the mount across VFS_START(). */
|
||||
vfs_ref(mp);
|
||||
@ -825,7 +837,7 @@ err_mounted:
|
||||
|
||||
err_unmounted:
|
||||
vp->v_mountedhere = NULL;
|
||||
mutex_exit(&mp->mnt_updating);
|
||||
mutex_exit(mp->mnt_updating);
|
||||
vfs_rele(mp);
|
||||
|
||||
return error;
|
||||
@ -863,7 +875,7 @@ dounmount(struct mount *mp, int flags, struct lwp *l)
|
||||
used_extattr = mp->mnt_flag & MNT_EXTATTR;
|
||||
|
||||
mp->mnt_iflag |= IMNT_UNMOUNT;
|
||||
mutex_enter(&mp->mnt_updating);
|
||||
mutex_enter(mp->mnt_updating);
|
||||
async = mp->mnt_flag & MNT_ASYNC;
|
||||
mp->mnt_flag &= ~MNT_ASYNC;
|
||||
cache_purgevfs(mp); /* remove cache entries for this file sys */
|
||||
@ -881,7 +893,7 @@ dounmount(struct mount *mp, int flags, struct lwp *l)
|
||||
if ((mp->mnt_flag & (MNT_RDONLY | MNT_ASYNC)) == 0)
|
||||
vfs_syncer_add_to_worklist(mp);
|
||||
mp->mnt_flag |= async;
|
||||
mutex_exit(&mp->mnt_updating);
|
||||
mutex_exit(mp->mnt_updating);
|
||||
if (!was_suspended)
|
||||
vfs_resume(mp);
|
||||
if (used_extattr) {
|
||||
@ -892,7 +904,7 @@ dounmount(struct mount *mp, int flags, struct lwp *l)
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
mutex_exit(&mp->mnt_updating);
|
||||
mutex_exit(mp->mnt_updating);
|
||||
|
||||
/*
|
||||
* mark filesystem as gone to prevent further umounts
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* $NetBSD: vfs_subr.c,v 1.477 2019/12/15 20:30:03 joerg Exp $ */
|
||||
/* $NetBSD: vfs_subr.c,v 1.478 2019/12/22 19:47:34 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008, 2019
|
||||
* The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
@ -68,7 +69,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.477 2019/12/15 20:30:03 joerg Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.478 2019/12/22 19:47:34 ad Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_ddb.h"
|
||||
@ -667,13 +668,13 @@ vn_syncer_remove_from_worklist(struct vnode *vp)
|
||||
|
||||
KASSERT(mutex_owned(vp->v_interlock));
|
||||
|
||||
mutex_enter(&syncer_data_lock);
|
||||
if (vp->v_iflag & VI_ONWORKLST) {
|
||||
mutex_enter(&syncer_data_lock);
|
||||
vp->v_iflag &= ~VI_ONWORKLST;
|
||||
slp = &syncer_workitem_pending[vip->vi_synclist_slot];
|
||||
TAILQ_REMOVE(slp, vip, vi_synclist);
|
||||
mutex_exit(&syncer_data_lock);
|
||||
}
|
||||
mutex_exit(&syncer_data_lock);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -685,7 +686,7 @@ vfs_syncer_add_to_worklist(struct mount *mp)
|
||||
static int start, incr, next;
|
||||
int vdelay;
|
||||
|
||||
KASSERT(mutex_owned(&mp->mnt_updating));
|
||||
KASSERT(mutex_owned(mp->mnt_updating));
|
||||
KASSERT((mp->mnt_iflag & IMNT_ONWORKLIST) == 0);
|
||||
|
||||
/*
|
||||
@ -716,7 +717,7 @@ void
|
||||
vfs_syncer_remove_from_worklist(struct mount *mp)
|
||||
{
|
||||
|
||||
KASSERT(mutex_owned(&mp->mnt_updating));
|
||||
KASSERT(mutex_owned(mp->mnt_updating));
|
||||
KASSERT((mp->mnt_iflag & IMNT_ONWORKLIST) != 0);
|
||||
|
||||
mp->mnt_iflag &= ~IMNT_ONWORKLIST;
|
||||
@ -1575,7 +1576,7 @@ vfs_mount_print(struct mount *mp, int full, void (*pr)(const char *, ...))
|
||||
snprintb(sbuf, sizeof(sbuf), __IMNT_FLAG_BITS, mp->mnt_iflag);
|
||||
(*pr)("iflag = %s\n", sbuf);
|
||||
|
||||
(*pr)("refcnt = %d updating @ %p\n", mp->mnt_refcnt, &mp->mnt_updating);
|
||||
(*pr)("refcnt = %d updating @ %p\n", mp->mnt_refcnt, mp->mnt_updating);
|
||||
|
||||
(*pr)("statvfs cache:\n");
|
||||
(*pr)("\tbsize = %lu\n",mp->mnt_stat.f_bsize);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: vfs_syscalls.c,v 1.537 2019/09/26 01:34:16 christos Exp $ */
|
||||
/* $NetBSD: vfs_syscalls.c,v 1.538 2019/12/22 19:47:34 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 2008, 2009, 2019 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
@ -70,7 +70,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.537 2019/09/26 01:34:16 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.538 2019/12/22 19:47:34 ad Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_fileassoc.h"
|
||||
@ -296,7 +296,7 @@ mount_update(struct lwp *l, struct vnode *vp, const char *path, int flags,
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
mutex_enter(&mp->mnt_updating);
|
||||
mutex_enter(mp->mnt_updating);
|
||||
|
||||
mp->mnt_flag &= ~MNT_OP_FLAGS;
|
||||
mp->mnt_flag |= flags & MNT_OP_FLAGS;
|
||||
@ -348,7 +348,7 @@ mount_update(struct lwp *l, struct vnode *vp, const char *path, int flags,
|
||||
if ((mp->mnt_iflag & IMNT_ONWORKLIST) != 0)
|
||||
vfs_syncer_remove_from_worklist(mp);
|
||||
}
|
||||
mutex_exit(&mp->mnt_updating);
|
||||
mutex_exit(mp->mnt_updating);
|
||||
vfs_resume(mp);
|
||||
|
||||
if ((error == 0) && !(saved_flags & MNT_EXTATTR) &&
|
||||
@ -445,12 +445,12 @@ mount_getargs(struct lwp *l, struct vnode *vp, const char *path, int flags,
|
||||
if (vfs_busy(mp))
|
||||
return EPERM;
|
||||
|
||||
mutex_enter(&mp->mnt_updating);
|
||||
mutex_enter(mp->mnt_updating);
|
||||
mp->mnt_flag &= ~MNT_OP_FLAGS;
|
||||
mp->mnt_flag |= MNT_GETARGS;
|
||||
error = VFS_MOUNT(mp, path, data, data_len);
|
||||
mp->mnt_flag &= ~MNT_OP_FLAGS;
|
||||
mutex_exit(&mp->mnt_updating);
|
||||
mutex_exit(mp->mnt_updating);
|
||||
|
||||
vfs_unbusy(mp);
|
||||
return (error);
|
||||
@ -655,7 +655,7 @@ do_sys_sync(struct lwp *l)
|
||||
|
||||
mountlist_iterator_init(&iter);
|
||||
while ((mp = mountlist_iterator_next(iter)) != NULL) {
|
||||
mutex_enter(&mp->mnt_updating);
|
||||
mutex_enter(mp->mnt_updating);
|
||||
if ((mp->mnt_flag & MNT_RDONLY) == 0) {
|
||||
asyncflag = mp->mnt_flag & MNT_ASYNC;
|
||||
mp->mnt_flag &= ~MNT_ASYNC;
|
||||
@ -663,7 +663,7 @@ do_sys_sync(struct lwp *l)
|
||||
if (asyncflag)
|
||||
mp->mnt_flag |= MNT_ASYNC;
|
||||
}
|
||||
mutex_exit(&mp->mnt_updating);
|
||||
mutex_exit(mp->mnt_updating);
|
||||
}
|
||||
mountlist_iterator_destroy(iter);
|
||||
#ifdef DEBUG
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: genfs_vfsops.c,v 1.9 2019/02/20 10:07:27 hannken Exp $ */
|
||||
/* $NetBSD: genfs_vfsops.c,v 1.10 2019/12/22 19:47:34 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 2008, 2009, 2019 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: genfs_vfsops.c,v 1.9 2019/02/20 10:07:27 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: genfs_vfsops.c,v 1.10 2019/12/22 19:47:34 ad Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
@ -61,7 +61,7 @@ genfs_statvfs(struct mount *mp, struct statvfs *sbp)
|
||||
int
|
||||
genfs_renamelock_enter(struct mount *mp)
|
||||
{
|
||||
mutex_enter(&mp->mnt_renamelock);
|
||||
mutex_enter(mp->mnt_renamelock);
|
||||
/* Preserve possible error return in case we become interruptible. */
|
||||
return 0;
|
||||
}
|
||||
@ -69,7 +69,7 @@ genfs_renamelock_enter(struct mount *mp)
|
||||
void
|
||||
genfs_renamelock_exit(struct mount *mp)
|
||||
{
|
||||
mutex_exit(&mp->mnt_renamelock);
|
||||
mutex_exit(mp->mnt_renamelock);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: nfs_export.c,v 1.60 2017/04/17 08:32:01 hannken Exp $ */
|
||||
/* $NetBSD: nfs_export.c,v 1.61 2019/12/22 19:47:34 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998, 2004, 2005, 2008 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 1997, 1998, 2004, 2005, 2008, 2019 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
@ -77,7 +77,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_export.c,v 1.60 2017/04/17 08:32:01 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_export.c,v 1.61 2019/12/22 19:47:34 ad Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -217,9 +217,9 @@ netexport_fini(void)
|
||||
kpause("nfsfini", false, hz, NULL);
|
||||
continue;
|
||||
}
|
||||
mutex_enter(&mp->mnt_updating); /* mnt_flag */
|
||||
mutex_enter(mp->mnt_updating); /* mnt_flag */
|
||||
netexport_unmount(mp);
|
||||
mutex_exit(&mp->mnt_updating); /* mnt_flag */
|
||||
mutex_exit(mp->mnt_updating); /* mnt_flag */
|
||||
vfs_unbusy(mp);
|
||||
}
|
||||
rw_destroy(&netexport_lock);
|
||||
@ -289,7 +289,7 @@ mountd_set_exports_list(const struct mountd_exports_list *mel, struct lwp *l,
|
||||
if (error != 0)
|
||||
return error;
|
||||
if (nmp == NULL)
|
||||
mutex_enter(&mp->mnt_updating); /* mnt_flag */
|
||||
mutex_enter(mp->mnt_updating); /* mnt_flag */
|
||||
netexport_wrlock();
|
||||
ne = netexport_lookup(mp);
|
||||
if (ne == NULL) {
|
||||
@ -331,7 +331,7 @@ mountd_set_exports_list(const struct mountd_exports_list *mel, struct lwp *l,
|
||||
out:
|
||||
netexport_wrunlock();
|
||||
if (nmp == NULL)
|
||||
mutex_exit(&mp->mnt_updating); /* mnt_flag */
|
||||
mutex_exit(mp->mnt_updating); /* mnt_flag */
|
||||
vfs_unbusy(mp);
|
||||
return error;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mount.h,v 1.234 2019/01/01 10:06:54 hannken Exp $ */
|
||||
/* $NetBSD: mount.h,v 1.235 2019/12/22 19:47:34 ad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1991, 1993
|
||||
@ -133,29 +133,38 @@ struct vattr;
|
||||
* array of operations and an instance record.
|
||||
*/
|
||||
struct mount {
|
||||
TAILQ_HEAD(, vnode_impl) mnt_vnodelist; /* list of vnodes this mount */
|
||||
/*
|
||||
* Mostly stable data.
|
||||
*/
|
||||
kmutex_t *mnt_vnodelock; /* lock on mnt_vnodelist */
|
||||
struct vfsops *mnt_op; /* operations on fs */
|
||||
struct vnode *mnt_vnodecovered; /* vnode we mounted on */
|
||||
struct mount *mnt_lower; /* fs mounted on */
|
||||
int mnt_synclist_slot; /* synclist slot index */
|
||||
void *mnt_transinfo; /* for FS-internal use */
|
||||
void *mnt_data; /* private data */
|
||||
kmutex_t mnt_renamelock; /* per-fs rename lock */
|
||||
int mnt_refcnt; /* ref count on this structure */
|
||||
kmutex_t *mnt_renamelock; /* per-fs rename lock */
|
||||
int mnt_flag; /* flags */
|
||||
int mnt_iflag; /* internal flags */
|
||||
int mnt_fs_bshift; /* offset shift for lblkno */
|
||||
int mnt_dev_bshift; /* shift for device sectors */
|
||||
struct statvfs mnt_stat; /* cache of filesystem stats */
|
||||
specificdata_reference
|
||||
mnt_specdataref; /* subsystem specific data */
|
||||
kmutex_t mnt_updating; /* to serialize updates */
|
||||
kmutex_t *mnt_updating; /* to serialize updates */
|
||||
const struct wapbl_ops
|
||||
*mnt_wapbl_op; /* logging ops */
|
||||
struct wapbl *mnt_wapbl; /* log info */
|
||||
struct wapbl_replay
|
||||
*mnt_wapbl_replay; /* replay support XXX: what? */
|
||||
uint64_t mnt_gen;
|
||||
|
||||
/*
|
||||
* Volatile data: pad to keep away from the stable items.
|
||||
*/
|
||||
int mnt_refcnt /* ref count on this structure */
|
||||
__aligned(COHERENCY_UNIT);
|
||||
int mnt_synclist_slot; /* synclist slot index */
|
||||
TAILQ_HEAD(, vnode_impl) mnt_vnodelist; /* list of vnodes this mount */
|
||||
struct statvfs mnt_stat; /* cache of filesystem stats */
|
||||
};
|
||||
|
||||
#endif /* defined(_KERNEL) || defined(__EXPOSE_MOUNT) */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vnode.h,v 1.285 2019/12/15 21:56:13 ad Exp $ */
|
||||
/* $NetBSD: vnode.h,v 1.286 2019/12/22 19:47:34 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
@ -417,11 +417,6 @@ struct vnodeop_desc {
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
/*
|
||||
* Interlock for scanning list of vnodes attached to a mountpoint
|
||||
*/
|
||||
extern kmutex_t mntvnode_lock;
|
||||
|
||||
/*
|
||||
* Union filesystem hook for vn_readdir().
|
||||
*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vnode_impl.h,v 1.18 2019/12/01 13:56:29 ad Exp $ */
|
||||
/* $NetBSD: vnode_impl.h,v 1.19 2019/12/22 19:47:34 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2016, 2019 The NetBSD Foundation, Inc.
|
||||
@ -59,7 +59,7 @@ struct vcache_key {
|
||||
* c vcache_lock
|
||||
* d vdrain_lock
|
||||
* i v_interlock
|
||||
* m mntvnode_lock
|
||||
* m mnt_vnodelock
|
||||
* n namecache_lock
|
||||
* s syncer_data_lock
|
||||
*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ulfs_vfsops.c,v 1.14 2018/12/10 14:46:25 maxv Exp $ */
|
||||
/* $NetBSD: ulfs_vfsops.c,v 1.15 2019/12/22 19:47:35 ad Exp $ */
|
||||
/* from NetBSD: ufs_vfsops.c,v 1.54 2015/03/17 09:39:29 hannken Exp */
|
||||
|
||||
/*
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ulfs_vfsops.c,v 1.14 2018/12/10 14:46:25 maxv Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ulfs_vfsops.c,v 1.15 2019/12/22 19:47:35 ad Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_lfs.h"
|
||||
@ -116,11 +116,11 @@ ulfs_quotactl(struct mount *mp, struct quotactl_args *args)
|
||||
if (error) {
|
||||
return (error);
|
||||
}
|
||||
mutex_enter(&mp->mnt_updating);
|
||||
mutex_enter(mp->mnt_updating);
|
||||
|
||||
error = lfsquota_handle_cmd(mp, l, args);
|
||||
|
||||
mutex_exit(&mp->mnt_updating);
|
||||
mutex_exit(mp->mnt_updating);
|
||||
vfs_unbusy(mp);
|
||||
return (error);
|
||||
#endif
|
||||
@ -172,7 +172,7 @@ ulfs_quotactl(struct mount *mp, struct quotactl_args *args)
|
||||
return (error);
|
||||
}
|
||||
|
||||
mutex_enter(&mp->mnt_updating);
|
||||
mutex_enter(mp->mnt_updating);
|
||||
switch (cmd) {
|
||||
|
||||
case Q_QUOTAON:
|
||||
@ -202,7 +202,7 @@ ulfs_quotactl(struct mount *mp, struct quotactl_args *args)
|
||||
default:
|
||||
error = EINVAL;
|
||||
}
|
||||
mutex_exit(&mp->mnt_updating);
|
||||
mutex_exit(mp->mnt_updating);
|
||||
vfs_unbusy(mp);
|
||||
return (error);
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ufs_vfsops.c,v 1.57 2019/06/20 03:31:30 pgoyette Exp $ */
|
||||
/* $NetBSD: ufs_vfsops.c,v 1.58 2019/12/22 19:47:35 ad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993, 1994
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_vfsops.c,v 1.57 2019/06/20 03:31:30 pgoyette Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_vfsops.c,v 1.58 2019/12/22 19:47:35 ad Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
@ -137,11 +137,11 @@ ufs_quotactl(struct mount *mp, struct quotactl_args *args)
|
||||
if (error) {
|
||||
return (error);
|
||||
}
|
||||
mutex_enter(&mp->mnt_updating);
|
||||
mutex_enter(mp->mnt_updating);
|
||||
|
||||
error = quota_handle_cmd(mp, l, args);
|
||||
|
||||
mutex_exit(&mp->mnt_updating);
|
||||
mutex_exit(mp->mnt_updating);
|
||||
vfs_unbusy(mp);
|
||||
return (error);
|
||||
#endif
|
||||
@ -193,7 +193,7 @@ ufs_quotactl(struct mount *mp, struct quotactl_args *args)
|
||||
return (error);
|
||||
}
|
||||
|
||||
mutex_enter(&mp->mnt_updating);
|
||||
mutex_enter(mp->mnt_updating);
|
||||
switch (cmd) {
|
||||
|
||||
case Q_QUOTAON:
|
||||
@ -223,7 +223,7 @@ ufs_quotactl(struct mount *mp, struct quotactl_args *args)
|
||||
default:
|
||||
error = EINVAL;
|
||||
}
|
||||
mutex_exit(&mp->mnt_updating);
|
||||
mutex_exit(mp->mnt_updating);
|
||||
vfs_unbusy(mp);
|
||||
return (error);
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ufs_wapbl.c,v 1.24 2017/03/01 10:42:45 hannken Exp $ */
|
||||
/* $NetBSD: ufs_wapbl.c,v 1.25 2019/12/22 19:47:35 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc.
|
||||
@ -66,7 +66,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_wapbl.c,v 1.24 2017/03/01 10:42:45 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_wapbl.c,v 1.25 2019/12/22 19:47:35 ad Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -108,7 +108,7 @@ ufs_wapbl_verify_inodes(struct mount *mp, const char *str)
|
||||
struct inode *ip;
|
||||
struct buf *bp, *nbp;
|
||||
|
||||
mutex_enter(&mntvnode_lock);
|
||||
mutex_enter(mp->mnt_vnodelock);
|
||||
loop:
|
||||
TAILQ_FOREACH_REVERSE(vp, &mp->mnt_vnodelist, vnodelst, v_mntvnodes) {
|
||||
/*
|
||||
@ -117,11 +117,11 @@ ufs_wapbl_verify_inodes(struct mount *mp, const char *str)
|
||||
*/
|
||||
if (vp->v_mount != mp)
|
||||
goto loop;
|
||||
mutex_enter(&vp->v_interlock);
|
||||
mutex_enter(vp->v_interlock);
|
||||
nvp = TAILQ_NEXT(vp, v_mntvnodes);
|
||||
ip = VTOI(vp);
|
||||
if (vp->v_type == VNON) {
|
||||
mutex_exit(&vp->v_interlock);
|
||||
mutex_exit(vp->v_interlock);
|
||||
continue;
|
||||
}
|
||||
/* verify that update has been called on all inodes */
|
||||
@ -129,7 +129,7 @@ ufs_wapbl_verify_inodes(struct mount *mp, const char *str)
|
||||
panic("wapbl_verify: mp %p: dirty vnode %p (inode %p): 0x%x\n",
|
||||
mp, vp, ip, ip->i_flag);
|
||||
}
|
||||
mutex_exit(&mntvnode_lock);
|
||||
mutex_exit(mp->mnt_vnodelock);
|
||||
|
||||
mutex_enter(&bufcache_lock);
|
||||
for (bp = LIST_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) {
|
||||
@ -141,14 +141,14 @@ ufs_wapbl_verify_inodes(struct mount *mp, const char *str)
|
||||
KASSERT((bp->b_flags & B_LOCKED) != 0);
|
||||
}
|
||||
mutex_exit(&bufcache_lock);
|
||||
mutex_exit(&vp->v_interlock);
|
||||
mutex_exit(vp->v_interlock);
|
||||
|
||||
mutex_enter(&mntvnode_lock);
|
||||
mutex_enter(mp->mnt_vnodelock);
|
||||
}
|
||||
mutex_exit(&mntvnode_lock);
|
||||
mutex_exit(mp->mnt_vnodelock);
|
||||
|
||||
vp = VFSTOUFS(mp)->um_devvp;
|
||||
mutex_enter(&vp->v_interlock);
|
||||
mutex_enter(vp->v_interlock);
|
||||
mutex_enter(&bufcache_lock);
|
||||
for (bp = LIST_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) {
|
||||
nbp = LIST_NEXT(bp, b_vnbufs);
|
||||
@ -159,6 +159,6 @@ ufs_wapbl_verify_inodes(struct mount *mp, const char *str)
|
||||
KASSERT((bp->b_flags & B_LOCKED) != 0);
|
||||
}
|
||||
mutex_exit(&bufcache_lock);
|
||||
mutex_exit(&vp->v_interlock);
|
||||
mutex_exit(vp->v_interlock);
|
||||
}
|
||||
#endif /* WAPBL_DEBUG_INODES */
|
||||
|
Loading…
x
Reference in New Issue
Block a user