diff options
author | Jeff Roberson <jeff@FreeBSD.org> | 2005-04-03 23:50:20 +0000 |
---|---|---|
committer | Jeff Roberson <jeff@FreeBSD.org> | 2005-04-03 23:50:20 +0000 |
commit | 9a6bb8ad8f9bd7ddb95f6b3c9185e5a07e194489 (patch) | |
tree | 58b7e7695509853df16768dcd4760685e99b12a3 /sys/kern/vfs_lookup.c | |
parent | dfe614392f22434fbc04da31cb3253d8fb183930 (diff) | |
download | src-9a6bb8ad8f9bd7ddb95f6b3c9185e5a07e194489.tar.gz src-9a6bb8ad8f9bd7ddb95f6b3c9185e5a07e194489.zip |
Notes
Diffstat (limited to 'sys/kern/vfs_lookup.c')
-rw-r--r-- | sys/kern/vfs_lookup.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 9177cee10f28..709282faef4b 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ktrace.h" #include "opt_mac.h" +#include "opt_vfs.h" #include <sys/param.h> #include <sys/systm.h> @@ -52,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include <sys/filedesc.h> #include <sys/proc.h> #include <sys/syscallsubr.h> +#include <sys/sysctl.h> #ifdef KTRACE #include <sys/ktrace.h> #endif @@ -75,6 +77,14 @@ nameiinit(void *dummy __unused) } SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_SECOND, nameiinit, NULL) +#ifdef LOOKUP_SHARED +static int lookup_shared = 1; +#else +static int lookup_shared = 0; +#endif +SYSCTL_INT(_vfs, OID_AUTO, lookup_shared, CTLFLAG_RW, &lookup_shared, 0, + "Enables/Disables shared locks for path name translation"); + /* * Convert a pathname into a pointer to a locked inode. * @@ -117,9 +127,8 @@ namei(ndp) ("namei: nameiop contaminated with flags")); KASSERT((cnp->cn_flags & OPMASK) == 0, ("namei: flags contaminated with nameiops")); -#ifndef LOOKUP_SHARED - cnp->cn_flags &= ~LOCKSHARED; -#endif + if (!lookup_shared) + cnp->cn_flags &= ~LOCKSHARED; fdp = p->p_fd; /* @@ -362,15 +371,14 @@ lookup(ndp) rdonly = cnp->cn_flags & RDONLY; cnp->cn_flags &= ~ISSYMLINK; ndp->ni_dvp = NULL; -#ifdef LOOKUP_SHARED /* * We use shared locks until we hit the parent of the last cn then * we adjust based on the requesting flags. */ - cnp->cn_lkflags = LK_SHARED; -#else - cnp->cn_lkflags = LK_EXCLUSIVE; -#endif + if (lookup_shared) + cnp->cn_lkflags = LK_SHARED; + else + cnp->cn_lkflags = LK_EXCLUSIVE; dp = ndp->ni_startdir; ndp->ni_startdir = NULLVP; vn_lock(dp, cnp->cn_lkflags | LK_RETRY, td); |