Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177642196
D58567.1794927920.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D58567.1794927920.diff
View Options
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
@@ -1880,7 +1880,8 @@
}
static void
-dounmount_cleanup(struct mount *mp, struct vnode *coveredvp, int mntkflags)
+dounmount_cleanup(struct mount *mp, struct vnode *coveredvp, int mntkflags,
+ bool disablerec)
{
mtx_assert(MNT_MTX(mp), MA_OWNED);
@@ -1892,6 +1893,8 @@
vfs_op_exit_locked(mp);
MNT_IUNLOCK(mp);
if (coveredvp != NULL) {
+ if (disablerec)
+ VN_LOCK_DREC(coveredvp);
VOP_UNLOCK(coveredvp);
vdrop(coveredvp);
}
@@ -2193,6 +2196,7 @@
uint64_t async_flag;
int mnt_gen_r;
unsigned int retries;
+ bool coveredrec;
KASSERT((flags & MNT_DEFERRED) == 0 ||
(flags & (MNT_RECURSE | MNT_FORCE)) == (MNT_RECURSE | MNT_FORCE),
@@ -2301,6 +2305,7 @@
if ((flags & MNT_DEFERRED) != 0)
vfs_ref(mp);
+ coveredrec = false;
if ((coveredvp = mp->mnt_vnodecovered) != NULL) {
mnt_gen_r = mp->mnt_gen;
VI_LOCK(coveredvp);
@@ -2317,6 +2322,19 @@
vfs_rel(mp);
return (EBUSY);
}
+
+ /*
+ * For some complex nullfs mount configurations, it is
+ * possible to get the covered vnode lock for the
+ * mount shared with some inside-mount vnode lock.
+ * Then at unmount time, vflush() would recurse on the
+ * covered vnode lock when reclaiming the vnode.
+ *
+ * To work around it, temprorarily allow recursion for
+ * the covered vnode lock.
+ */
+ coveredrec = VN_LOCK_CANREC(coveredvp);
+ VN_LOCK_AREC(coveredvp);
}
vfs_op_enter(mp);
@@ -2326,7 +2344,7 @@
if ((mp->mnt_kern_flag & MNTK_UNMOUNT) != 0 ||
(mp->mnt_flag & MNT_UPDATE) != 0 ||
!TAILQ_EMPTY(&mp->mnt_uppers)) {
- dounmount_cleanup(mp, coveredvp, 0);
+ dounmount_cleanup(mp, coveredvp, 0, !coveredrec);
return (EBUSY);
}
mp->mnt_kern_flag |= MNTK_UNMOUNT;
@@ -2339,7 +2357,8 @@
MNT_ILOCK(mp);
if (error != 0) {
vn_seqc_write_end(coveredvp);
- dounmount_cleanup(mp, coveredvp, MNTK_UNMOUNT);
+ dounmount_cleanup(mp, coveredvp, MNTK_UNMOUNT,
+ !coveredrec);
if (rootvp != NULL) {
vn_seqc_write_end(rootvp);
vrele(rootvp);
@@ -2425,6 +2444,8 @@
MNT_IUNLOCK(mp);
if (coveredvp) {
vn_seqc_write_end(coveredvp);
+ if (!coveredrec)
+ VN_LOCK_DREC(coveredvp);
VOP_UNLOCK(coveredvp);
vdrop(coveredvp);
}
@@ -2445,6 +2466,8 @@
coveredvp->v_mountedhere = NULL;
vn_seqc_write_end_locked(coveredvp);
VI_UNLOCK(coveredvp);
+ if (!coveredrec)
+ VN_LOCK_DREC(coveredvp);
VOP_UNLOCK(coveredvp);
vdrop(coveredvp);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 17, 3:05 PM (13 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41801862
Default Alt Text
D58567.1794927920.diff (2 KB)
Attached To
Mode
D58567: dounmount(9): temporarily enable recursion for the covered vnode lock
Attached
Detach File
Event Timeline