git: 0c01203e4725 - main - vfs_lookup(): re-check v_mountedhere on lock upgrade

From: Jason A. Harmening <jah_at_FreeBSD.org>
Date: Tue, 18 Apr 2023 01:35:46 UTC
The branch main has been updated by jah:

URL: https://cgit.FreeBSD.org/src/commit/?id=0c01203e472567017da3e525e409c83bd5418a75

commit 0c01203e472567017da3e525e409c83bd5418a75
Author:     Jason A. Harmening <jah@FreeBSD.org>
AuthorDate: 2023-03-28 18:06:29 +0000
Commit:     Jason A. Harmening <jah@FreeBSD.org>
CommitDate: 2023-04-18 01:31:40 +0000

    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 @@ good:
 					error = ENOENT;
 					goto bad2;
 				}
+				if (dp->v_mountedhere != mp) {
+					continue;
+				}
 			} else
 				crosslkflags &= ~LK_NODDLKTREAT;
 		}