Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177637321
D58180.1794912828.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D58180.1794912828.diff
View Options
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -3774,6 +3774,21 @@
vref(vp);
addend = 0;
if (vp->v_type != VDIR) {
+ if ((vp->v_vflag & VV_ROOT) != 0) {
+ struct vnode *covered_vp;
+
+ /* File mount root: resolve via the covered vnode. */
+ vn_lock(vp, LK_RETRY | LK_SHARED);
+ if (VN_IS_DOOMED(vp) ||
+ (covered_vp = vp->v_mount->mnt_vnodecovered) == NULL ||
+ covered_vp->v_mountedhere != vp->v_mount) {
+ vput(vp);
+ return (ENOENT);
+ }
+ vref(covered_vp);
+ vput(vp);
+ vp = covered_vp;
+ }
*buflen -= 1;
buf[*buflen] = '\0';
error = vn_vptocnp(&vp, buf, buflen);
@@ -3831,23 +3846,11 @@
if (type == VBAD)
return (ENOENT);
- /*
- * For file mounts dvp is vp_crossmp and unusable; resolve via the
- * covered vnode instead, whose path is unique since file mounts
- * require nlink == 1.
- */
+ /* For file mounts dvp is vp_crossmp; vn_fullpath() resolves them. */
if (type != VDIR && (vp->v_vflag & VV_ROOT) != 0) {
- struct vnode *covered_vp;
size_t len;
- error = vn_lock(vp, LK_SHARED);
- if (error != 0)
- return (error);
- covered_vp = vp->v_mount->mnt_vnodecovered;
- vref(covered_vp);
- VOP_UNLOCK(vp);
- error = vn_fullpath(covered_vp, retbuf, freebuf);
- vrele(covered_vp);
+ error = vn_fullpath(vp, retbuf, freebuf);
if (error != 0)
return (error);
len = strlen(*retbuf) + 1;
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -1182,8 +1182,12 @@
if (error == 0 && vp->v_type != VDIR)
error = ENOTDIR;
}
- if (error == 0 && (fsflags & MNT_EMPTYDIR) != 0)
- error = vn_dir_check_empty(vp);
+ if (error == 0 && (fsflags & MNT_EMPTYDIR) != 0) {
+ if (vp->v_type == VDIR)
+ error = vn_dir_check_empty(vp);
+ else
+ error = ENOTDIR;
+ }
if (error == 0) {
VI_LOCK(vp);
if ((vp->v_iflag & VI_MOUNT) == 0 && vp->v_mountedhere == NULL)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 17, 10:53 AM (57 m, 29 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41798319
Default Alt Text
D58180.1794912828.diff (1 KB)
Attached To
Mode
D58180: vfs: fix directory assumptions for nullfs file mounts
Attached
Detach File
Event Timeline