From 0c01203e472567017da3e525e409c83bd5418a75 Mon Sep 17 00:00:00 2001 From: "Jason A. Harmening" Date: Tue, 28 Mar 2023 13:06:29 -0500 Subject: [PATCH] vfs_lookup(): re-check v_mountedhere on lock upgrade The VV_CROSSLOCK handling logic may need to upgrade the covered vnode lock depending upon the requirements of the filesystem into which vfs_lookup() is walking. This may involve transiently dropping the lock, which can allow the target mount to be unmounted. Tested by: pho Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D39272 --- sys/kern/vfs_lookup.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 172aa4b4f576..d9a9cabde177 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -1280,6 +1280,9 @@ vfs_lookup(struct nameidata *ndp) error = ENOENT; goto bad2; } + if (dp->v_mountedhere != mp) { + continue; + } } else crosslkflags &= ~LK_NODDLKTREAT; }