Discussion:
[Bug 284914] autofs(4) confuses fts(3)
Add Reply
b***@freebsd.org
2025-02-20 01:53:37 UTC
Reply
Permalink
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284914

Lexi Winter <***@hemlock.eden.le-fay.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Assignee|***@FreeBSD.org |***@FreeBSD.org
--
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
b***@freebsd.org
2025-02-20 02:01:03 UTC
Reply
Permalink
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284914

Konstantin Belousov <***@FreeBSD.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |***@FreeBSD.org

--- Comment #1 from Konstantin Belousov <***@FreeBSD.org> ---
Look at the ktrace/kdump to see what exactly is failing.
--
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
b***@freebsd.org
2025-02-20 02:06:03 UTC
Reply
Permalink
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284914

--- Comment #2 from Lexi Winter <***@hemlock.eden.le-fay.org> ---
33368 find CALL write(0x1,0x28240d651000,0x1e)
33368 find GIO fd 1 wrote 30 bytes
"/home/ft/.ssh/known_hosts.old
"
33368 find RET write 30/0x1e
33368 find CALL
open(0x2675923a9781,0x120000<O_RDONLY|O_DIRECTORY|O_CLOEXEC>)
33368 find NAMI ".."
33368 find RET open 5
33368 find CALL fstat(0x5,0x267590a00240)
33368 find STRU struct stat {dev=687931149, ino=34, mode=040700, nlink=6,
uid=10020, gid=10006, rdev=0, atime=1740008641.500888000,
mtime=1730971526.664459000, ctime=1740008836.602277000,
birthtime=1730971526.664459000, size=18, blksize=4096, blocks=17, flags=0x800 }
33368 find RET fstat 0
33368 find CALL close(0x5)
33368 find RET close 0
33368 find CALL write(0x2,0x2675909ffb80,0x6)
33368 find GIO fd 2 wrote 6 bytes
"find: "

the device is (as expected) different from when it first opened the directory:

33368 find CALL statfs(0x28240d644000,0x28240d63a058)
33368 find NAMI "/home/ft"
33368 find RET statfs 0
33368 find CALL fstat(0x5,0x267590a00170)
33368 find STRU struct stat {dev=18446744072887533315, ino=7,
mode=040755, nlink=3, uid=0, gid=0, rdev=0, atime=1740015874.694741010,
mtime=1740015874.694741010, ctime=1740015874.694741010,
birthtime=1740015874.694741010, size=512, blksize=4096, blocks=1, flags=0x0 }

i suspect this trips the check in fts.c:fts_safe_changedir():

if (p->fts_dev != sb.st_dev || p->fts_ino != sb.st_ino) {
errno = ENOENT; /* disinformation */
ret = -1;
goto bail;
}
--
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
b***@freebsd.org
2025-02-20 02:10:55 UTC
Reply
Permalink
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284914

--- Comment #3 from Lexi Winter <***@hemlock.eden.le-fay.org> ---
so, setting vfs.autofs.mount_on_stat=1 fixes the problem:

# stat /home
18446744072887533315 1 drwxr-xr-x 3 root wheel 0 512 "Feb 20 00:17:28 2025"
"Feb 20 00:17:28 2025" "Feb 20 00:17:28 2025" "Feb 20 00:17:28 2025" 4096 1 0
/home

# stat /home/ft
18446744072887533315 7 drwxr-xr-x 3 root wheel 0 512 "Feb 20 01:44:34 2025"
"Feb 20 01:44:34 2025" "Feb 20 01:44:34 2025" "Feb 20 01:44:34 2025" 4096 1 0
/home/ft

# sysctl vfs.autofs.mount_on_stat=1

# stat /home
18446744072887533315 1 drwxr-xr-x 3 root wheel 0 512 "Feb 20 00:17:28 2025"
"Feb 20 00:17:28 2025" "Feb 20 00:17:28 2025" "Feb 20 00:17:28 2025" 4096 1 0
/home

# stat /home/ft
687931150 34 drwx------ 6 ft users 0 18 "Feb 19 23:44:01 2025" "Nov 7 09:25:26
2024" "Feb 19 23:47:16 2025" "Nov 7 09:25:26 2024" 4096 17 0x800 /home/ft

(and find now works.)

this is rather unfortunate as default behaviour though, especially since this
particular interaction doesn't seem to be documented in autofs(4).
--
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
b***@freebsd.org
2025-02-20 15:36:06 UTC
Reply
Permalink
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284914

--- Comment #4 from Konstantin Belousov <***@FreeBSD.org> ---
(In reply to Lexi Winter from comment #3)
FTS could be made more forgiving for the case where the detected mishap occurs
on
the automounted mount point.

I am not sure if it is worth the change, because it would make the check
slightly
less strict.
--
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
b***@freebsd.org
2025-02-21 00:28:44 UTC
Reply
Permalink
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284914

Edward Tomasz Napierala <***@FreeBSD.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |***@FreeBSD.org

--- Comment #5 from Edward Tomasz Napierala <***@FreeBSD.org> ---
It’s off by default because it’s terrible when you have a nontrivial number of
mounts.

I wonder if we could loosen up the fts(3) check iff the filesystem type is
autofs?
--
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
b***@freebsd.org
2025-02-21 13:12:12 UTC
Reply
Permalink
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284914

--- Comment #6 from Konstantin Belousov <***@FreeBSD.org> ---
(In reply to Edward Tomasz Napierala from comment #5)
This is same as what I suggested. The change is not tested
https://reviews.freebsd.org/D49094
--
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
b***@freebsd.org
2025-02-22 04:11:59 UTC
Reply
Permalink
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284914

--- Comment #7 from Lexi Winter <***@hemlock.eden.le-fay.org> ---
i had to turn off vfs.autofs.mount_on_stat because even with only a few (~5)
home directories, it absolutely murdered performance, e.g. mutt took several
seconds to reload my inbox. this might be a separate bug.

i am personally in favour of the fts(3) to change to make this work
transparently; would it help if i tested the proposed patch to see if it fixed
the original problem?
--
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
b***@freebsd.org
2025-02-22 13:51:59 UTC
Reply
Permalink
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284914

--- Comment #8 from Konstantin Belousov <***@FreeBSD.org> ---
(In reply to Lexi Winter from comment #7)
Of course I cannot commit the change unless it is tested. I do not have a
setup
to reproduce the problem.
--
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
b***@freebsd.org
2025-02-25 02:47:47 UTC
Reply
Permalink
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284914

--- Comment #9 from Lexi Winter <***@hemlock.eden.le-fay.org> ---
i've tested the patch from D49094, it seems to fix the issue (tested with find
and du).
--
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
b***@freebsd.org
2025-02-25 07:20:34 UTC
Reply
Permalink
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284914

--- Comment #10 from commit-***@FreeBSD.org ---
A commit in branch main references this bug:

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

commit e59991206b1463b7e85cc8aafde7f1dc03fcedcf
Author: Konstantin Belousov <***@FreeBSD.org>
AuthorDate: 2025-02-21 13:07:43 +0000
Commit: Konstantin Belousov <***@FreeBSD.org>
CommitDate: 2025-02-25 07:09:29 +0000

fts(3): be less strict when automount does its job under us walking autofs
mount

Namely, allow the file id change if the resulting file belongs to
automounted filesystem. If it is, remember the updated id.

This allows the ids from the automounted volumes to change without
restrictions, might be a further refinement would be to only allow such
inconsistency once.

PR: 284914
Reported and tested by: Lexi Winter <***@hemlock.eden.le-fay.org>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D49094

lib/libc/gen/fts.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
--
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
b***@freebsd.org
2025-02-28 17:19:41 UTC
Reply
Permalink
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284914

Mark Johnston <***@FreeBSD.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |***@FreeBSD.org
Status|New |In Progress
Assignee|***@FreeBSD.org |***@FreeBSD.org
--
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...