summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_export.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2008-06-09 10:31:38 +0000
committerkib <kib@FreeBSD.org>2008-06-09 10:31:38 +0000
commit926d12d0ea65c1b10638efb17de093ecc2fe4063 (patch)
treeab9745925fe55b9a4f33ea4af659d8d13f96cc4f /sys/kern/vfs_export.c
parent98ec5e76a88638596bb55271c5e91a26f266703d (diff)
downloadFreeBSD-src-926d12d0ea65c1b10638efb17de093ecc2fe4063.zip
FreeBSD-src-926d12d0ea65c1b10638efb17de093ecc2fe4063.tar.gz
Provide the mutual exclusion between the nfs export list modifications
and nfs requests processing. Lockmgr lock provides the shared locking for nfs requests, while exclusive mode is used for modifications. The writer starvation is handled by lockmgr too. Reported by: kris, pho, many Based on the submission by: mohan Tested by: pho MFC after: 2 weeks
Diffstat (limited to 'sys/kern/vfs_export.c')
-rw-r--r--sys/kern/vfs_export.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c
index 7afe991..439e84f 100644
--- a/sys/kern/vfs_export.c
+++ b/sys/kern/vfs_export.c
@@ -255,6 +255,7 @@ vfs_export(struct mount *mp, struct export_args *argp)
nep = mp->mnt_export;
error = 0;
+ lockmgr(&mp->mnt_explock, LK_EXCLUSIVE, NULL);
if (argp->ex_flags & MNT_DELEXPORT) {
if (nep == NULL) {
error = ENOENT;
@@ -294,6 +295,7 @@ vfs_export(struct mount *mp, struct export_args *argp)
}
out:
+ lockmgr(&mp->mnt_explock, LK_RELEASE, NULL);
/*
* Once we have executed the vfs_export() command, we do
* not want to keep the "export" option around in the
@@ -443,7 +445,9 @@ vfs_stdcheckexp(struct mount *mp, struct sockaddr *nam, int *extflagsp,
{
struct netcred *np;
+ lockmgr(&mp->mnt_explock, LK_SHARED, NULL);
np = vfs_export_lookup(mp, nam);
+ lockmgr(&mp->mnt_explock, LK_RELEASE, NULL);
if (np == NULL)
return (EACCES);
*extflagsp = np->netc_exflags;
OpenPOWER on IntegriCloud