The branch stable/15 has been updated by kib:

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

commit e84f15568e42027d3452a2813200a3e1449a135a
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2026-08-03 17:41:46 +0000
Commit:     Konstantin Belousov <[email protected]>
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);

Reply via email to