Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F170755963
D58191.id181920.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D58191.id181920.diff
View Options
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -1487,15 +1487,41 @@
error = EROFS;
goto bad2;
}
- if (!wantparent) {
+ if (wantparent) {
+ /*
+ * Do not return vp_crossmp for the case of mount
+ * over the regular file. Substitute ni_dvp with the
+ * covered vnode.
+ */
+ if (ndp->ni_dvp == vp_crossmp &&
+ (dp->v_vflag & VV_ROOT) != 0 && dp->v_type != VDIR) {
+ struct vnode *mvp;
+
+ vput(ndp->ni_dvp);
+ mvp = dp->v_mount->mnt_vnodecovered;
+ vref(mvp);
+ ndp->ni_dvp = mvp;
+ if ((cnp->cn_flags & LOCKPARENT) != 0) {
+ vn_lock_pair(dp, true, VOP_ISLOCKED(dp), mvp,
+ false, LK_EXCLUSIVE);
+ if (VN_IS_DOOMED(dp) || VN_IS_DOOMED(mvp)) {
+ error = ENOENT;
+ goto bad2;
+ }
+ } else {
+ ni_dvp_unlocked = 1;
+ }
+ } else if ((cnp->cn_flags & LOCKPARENT) == 0 &&
+ ndp->ni_dvp != dp) {
+ VOP_UNLOCK(ndp->ni_dvp);
+ ni_dvp_unlocked = 1;
+ }
+ } else {
ni_dvp_unlocked = 2;
if (ndp->ni_dvp != dp)
vput(ndp->ni_dvp);
else
vrele(ndp->ni_dvp);
- } else if ((cnp->cn_flags & LOCKPARENT) == 0 && ndp->ni_dvp != dp) {
- VOP_UNLOCK(ndp->ni_dvp);
- ni_dvp_unlocked = 1;
}
if (cnp->cn_flags & AUDITVNODE1)
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -3819,6 +3819,13 @@
}
#endif
fvp = fromnd.ni_vp;
+ if (fromnd.ni_dvp->v_type != VDIR) {
+ NDFREE_PNBUF(&fromnd);
+ vrele(fromnd.ni_dvp);
+ if (fvp != NULL)
+ vrele(fromnd.ni_vp);
+ return (EBUSY);
+ }
if (exchange && fvp == NULL) {
NDFREE_PNBUF(&fromnd);
vrele(fromnd.ni_dvp);
@@ -3840,7 +3847,7 @@
}
tdvp = tond.ni_dvp;
tvp = tond.ni_vp;
- if (tdvp == vp_crossmp) {
+ if (tdvp->v_type != VDIR) {
/*
* Rename of the root vnode of the mounted
* filesystem. It is possible to get there with the
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Sep 7, 10:45 AM (5 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38415522
Default Alt Text
D58191.id181920.diff (1 KB)
Attached To
Mode
D58191: lookup: do not return vp_crossmp as dvp for mount over the reg file
Attached
Detach File
Event Timeline
Log In to Comment