[Midnightbsd-cvs] src [8541] trunk/sys: add new mount flag that dotdot lookups shall override any shared lock requests.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Mon Sep 19 09:56:22 EDT 2016
Revision: 8541
http://svnweb.midnightbsd.org/src/?rev=8541
Author: laffer1
Date: 2016-09-19 09:56:22 -0400 (Mon, 19 Sep 2016)
Log Message:
-----------
add new mount flag that dotdot lookups shall override any shared lock requests.
Modified Paths:
--------------
trunk/sys/kern/vfs_lookup.c
trunk/sys/sys/mount.h
Modified: trunk/sys/kern/vfs_lookup.c
===================================================================
--- trunk/sys/kern/vfs_lookup.c 2016-09-19 13:55:32 UTC (rev 8540)
+++ trunk/sys/kern/vfs_lookup.c 2016-09-19 13:56:22 UTC (rev 8541)
@@ -385,11 +385,13 @@
}
static int
-compute_cn_lkflags(struct mount *mp, int lkflags)
+compute_cn_lkflags(struct mount *mp, int lkflags, int cnflags)
{
- if (mp == NULL ||
- ((lkflags & LK_SHARED) && !(mp->mnt_kern_flag & MNTK_LOOKUP_SHARED))) {
+ if (mp == NULL || ((lkflags & LK_SHARED) &&
+ (!(mp->mnt_kern_flag & MNTK_LOOKUP_SHARED) ||
+ ((cnflags & ISDOTDOT) &&
+ (mp->mnt_kern_flag & MNTK_LOOKUP_EXCL_DOTDOT))))) {
lkflags &= ~LK_SHARED;
lkflags |= LK_EXCLUSIVE;
}
@@ -518,7 +520,8 @@
dp = ndp->ni_startdir;
ndp->ni_startdir = NULLVP;
vn_lock(dp,
- compute_cn_lkflags(dp->v_mount, cnp->cn_lkflags | LK_RETRY));
+ compute_cn_lkflags(dp->v_mount, cnp->cn_lkflags | LK_RETRY,
+ cnp->cn_flags));
dirloop:
/*
@@ -675,7 +678,7 @@
VFS_UNLOCK_GIANT(tvfslocked);
vn_lock(dp,
compute_cn_lkflags(dp->v_mount, cnp->cn_lkflags |
- LK_RETRY));
+ LK_RETRY, ISDOTDOT));
}
}
@@ -713,7 +716,8 @@
vprint("lookup in", dp);
#endif
lkflags_save = cnp->cn_lkflags;
- cnp->cn_lkflags = compute_cn_lkflags(dp->v_mount, cnp->cn_lkflags);
+ cnp->cn_lkflags = compute_cn_lkflags(dp->v_mount, cnp->cn_lkflags,
+ cnp->cn_flags);
if ((error = VOP_LOOKUP(dp, &ndp->ni_vp, cnp)) != 0) {
cnp->cn_lkflags = lkflags_save;
KASSERT(ndp->ni_vp == NULL, ("leaf should be empty"));
@@ -732,7 +736,7 @@
VFS_UNLOCK_GIANT(tvfslocked);
vn_lock(dp,
compute_cn_lkflags(dp->v_mount, cnp->cn_lkflags |
- LK_RETRY));
+ LK_RETRY, cnp->cn_flags));
goto unionlookup;
}
@@ -804,8 +808,8 @@
dvfslocked = 0;
vref(vp_crossmp);
ndp->ni_dvp = vp_crossmp;
- error = VFS_ROOT(mp, compute_cn_lkflags(mp, cnp->cn_lkflags),
- &tdp);
+ error = VFS_ROOT(mp, compute_cn_lkflags(mp, cnp->cn_lkflags,
+ cnp->cn_flags), &tdp);
vfs_unbusy(mp);
if (vn_lock(vp_crossmp, LK_SHARED | LK_NOWAIT))
panic("vp_crossmp exclusively locked or reclaimed");
Modified: trunk/sys/sys/mount.h
===================================================================
--- trunk/sys/sys/mount.h 2016-09-19 13:55:32 UTC (rev 8540)
+++ trunk/sys/sys/mount.h 2016-09-19 13:56:22 UTC (rev 8541)
@@ -369,6 +369,7 @@
#define MNTK_NO_IOPF 0x00000100 /* Disallow page faults during reads
and writes. Filesystem shall properly
handle i/o state on EFAULT. */
+#define MNTK_LOOKUP_EXCL_DOTDOT 0x00000800
#define MNTK_NOASYNC 0x00800000 /* disable async */
#define MNTK_UNMOUNT 0x01000000 /* unmount in progress */
#define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */
More information about the Midnightbsd-cvs
mailing list