aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/vfs_extattr.c
diff options
context:
space:
mode:
authorJeff Roberson <jeff@FreeBSD.org>2002-03-12 04:00:11 +0000
committerJeff Roberson <jeff@FreeBSD.org>2002-03-12 04:00:11 +0000
commit8de00f4a8753f4a27d300005852156e6fe41698f (patch)
treedb3ad14ad172419e9392e38ccefc609f619092d3 /sys/kern/vfs_extattr.c
parentec5d7223f1ccb429c610bf8679ef069565bf8ddc (diff)
downloadsrc-8de00f4a8753f4a27d300005852156e6fe41698f.tar.gz
src-8de00f4a8753f4a27d300005852156e6fe41698f.zip
This patch adds the "LOCKSHARED" option to namei which causes it to only acquire shared locks on leafs.
The stat() and open() calls have been changed to make use of this new functionality. Using shared locks in these cases is sufficient and can significantly reduce their latency if IO is pending to these vnodes. Also, this reduces the number of exclusive locks that are floating around in the system, which helps reduce the number of deadlocks that occur. A new kernel option "LOOKUP_SHARED" has been added. It defaults to off so this patch can be turned on for testing, and should eventually go away once it is proven to be stable. I have personally been running this patch for over a year now, so it is believed to be fully stable. Reviewed by: jake, obrien Approved by: jake
Notes
Notes: svn path=/head/; revision=92130
Diffstat (limited to 'sys/kern/vfs_extattr.c')
-rw-r--r--sys/kern/vfs_extattr.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
index fd2260269f88..31b12446d454 100644
--- a/sys/kern/vfs_extattr.c
+++ b/sys/kern/vfs_extattr.c
@@ -2029,8 +2029,13 @@ stat(td, uap)
int error;
struct nameidata nd;
+#ifdef LOOKUP_SHARED
+ NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | NOOBJ,
+ UIO_USERSPACE, SCARG(uap, path), td);
+#else
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE,
SCARG(uap, path), td);
+#endif
if ((error = namei(&nd)) != 0)
return (error);
error = vn_stat(nd.ni_vp, &sb, td);