git: d3c3a705b5e6 - main - autofs: try to avoid waiting for timeouts of in-flight requests for forced unmounts
Konstantin Belousov <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.cvs.src |
|---|---|
| Message-ID | <6a744bed.3e53b.4d6a7c07__22847.7492973738$1786006539$gmane$org@gitrepo.freebsd.org> |
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d3c3a705b5e6689798057b764713bfc0e3b69f6a commit d3c3a705b5e6689798057b764713bfc0e3b69f6a Author: Konstantin Belousov <[email protected]> AuthorDate: 2026-08-04 06:26:56 +0000 Commit: Konstantin Belousov <[email protected]> CommitDate: 2026-08-06 08:54:47 +0000 autofs: try to avoid waiting for timeouts of in-flight requests for forced unmounts Do the advisory aborts of the in-flight requests before flushing the vnodes. It should mostly eliminate the waits due to requests busying the mp. Reported and reviewed by: rew Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D58637 --- sys/fs/autofs/autofs_vfsops.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/sys/fs/autofs/autofs_vfsops.c b/sys/fs/autofs/autofs_vfsops.c index 2159902f8b40..7e1d7c9d1f6a 100644 --- a/sys/fs/autofs/autofs_vfsops.c +++ b/sys/fs/autofs/autofs_vfsops.c @@ -109,6 +109,33 @@ autofs_mount(struct mount *mp) return (0); } +/* + * Try to abort any requests currently in flight. This is not + * strictly necessary, the strong pass is done after all vnodes are + * reclaimed, and does not prevent new requests from queueing. But + * doing it now should practically avoid waiting for timeouts because + * each in-flight requests busies the mount point, which makes + * unmount() to wait for it to drain. + */ +static void +autofs_purge(struct mount *mp) +{ + struct autofs_mount *amp; + struct autofs_request *ar; + + amp = VFSTOAUTOFS(mp); + sx_xlock(&autofs_softc->sc_lock); + TAILQ_FOREACH(ar, &autofs_softc->sc_requests, ar_next) { + if (ar->ar_mount != amp) + continue; + ar->ar_error = ENXIO; + ar->ar_done = true; + ar->ar_in_progress = false; + } + sx_xunlock(&autofs_softc->sc_lock); + cv_broadcast(&autofs_softc->sc_cv); +} + static int autofs_unmount(struct mount *mp, int mntflags) { @@ -208,6 +235,7 @@ static struct vfsops autofs_vfsops = { .vfs_fhtovp = NULL, /* XXX */ .vfs_mount = autofs_mount, .vfs_unmount = autofs_unmount, + .vfs_purge = autofs_purge, .vfs_root = autofs_root, .vfs_statfs = autofs_statfs, .vfs_init = autofs_init,