Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F165104008
D58180.id181815.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
D58180.id181815.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
Fri, Aug 7, 1:54 AM (13 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36139584
Default Alt Text
D58180.id181815.diff (1 KB)
Attached To
Mode
D58180: vfs: fix directory assumptions for nullfs file mounts
Attached
Detach File
Event Timeline
Log In to Comment