Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Aug 2026 11:05:57 +0000
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e84f15568e42 - stable/15 - autofs_lookup(): busy the mount point around autofs_trigger()
Message-ID:  <6a7b0215.3f5a2.27ed150@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by kib:

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

commit e84f15568e42027d3452a2813200a3e1449a135a
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-08-03 17:41:46 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-08-11 11:00:02 +0000

    autofs_lookup(): busy the mount point around autofs_trigger()
    
    PR:     294361
    
    (cherry picked from commit b95a859483f1ac0671bde55c0a2fc46f4db5ba4b)
---
 sys/fs/autofs/autofs_vnops.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/sys/fs/autofs/autofs_vnops.c b/sys/fs/autofs/autofs_vnops.c
index e8e47f20166a..5505435c423c 100644
--- a/sys/fs/autofs/autofs_vnops.c
+++ b/sys/fs/autofs/autofs_vnops.c
@@ -136,16 +136,22 @@ autofs_trigger_vn(struct vnode *vp, const char *path, int pathlen,
     struct vnode **newvp)
 {
 	struct autofs_node *anp;
+	struct mount *mp;
 	int error, lock_flags;
 
 	anp = vp->v_data;
 
 	/*
-	 * Release the vnode lock, so that other operations, in partcular
-	 * mounting a filesystem on top of it, can proceed.  Increase use
-	 * count, to prevent the vnode from being deallocated and to prevent
-	 * filesystem from being unmounted.
+	 * Release the vnode lock, so that other operations, in
+	 * particular mounting a filesystem on top of it, can proceed.
+	 * Increase use count and busy the mount, to prevent the vnode
+	 * from being deallocated and to prevent filesystem from being
+	 * unmounted.
 	 */
+	mp = vp->v_mount;
+	error = vfs_busy(mp, MBF_NOWAIT);
+	if (error != 0)
+		return (error);
 	lock_flags = VOP_ISLOCKED(vp);
 	vref(vp);
 	VOP_UNLOCK(vp);
@@ -165,6 +171,7 @@ mounted:
 	sx_xunlock(&autofs_softc->sc_lock);
 	vn_lock(vp, lock_flags | LK_RETRY);
 	vunref(vp);
+	vfs_unbusy(mp);
 	if (VN_IS_DOOMED(vp)) {
 		AUTOFS_DEBUG("VIRF_DOOMED");
 		return (ENOENT);


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a7b0215.3f5a2.27ed150>