Re: git: e59991206b14 - main - fts(3): be less strict when automount does its job under us walking autofs mount

From: Ronald Klop <ronald-lists_at_klop.ws>
Date: Wed, 26 Feb 2025 13:36:57 UTC
Van: Konstantin Belousov <kib@FreeBSD.org>
Datum: 25 februari 2025 08:20
Aan: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Onderwerp: git: e59991206b14 - main - fts(3): be less strict when  automount does its job under us walking autofs mount

> 
> 
> The branch main has been updated by kib:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=e59991206b1463b7e85cc8aafde7f1dc03fcedcf
> 
> commit e59991206b1463b7e85cc8aafde7f1dc03fcedcf
> Author:     Konstantin Belousov 
> AuthorDate: 2025-02-21 13:07:43 +0000
> Commit:     Konstantin Belousov 
> 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 
>     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(-)
> 
> diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c
> index 770a7b2cc322..bd193c7c6cfc 100644
> --- a/lib/libc/gen/fts.c
> +++ b/lib/libc/gen/fts.c
> @@ -1132,6 +1132,7 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, char *path)
>  {
>     int ret, oerrno, newfd;
>     struct stat sb;
> +   struct statfs sf;
>  
>     newfd = fd;
>     if (ISSET(FTS_NOCHDIR))
> @@ -1144,9 +1145,15 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, char *path)
>         goto bail;
>     }
>     if (p->fts_dev != sb.st_dev || p->fts_ino != sb.st_ino) {
> -       errno = ENOENT;     /* disinformation */
> -       ret = -1;
> -       goto bail;
> +       if (_fstatfs(newfd, &sf) != 0 ||
> +           (sf.f_flags & MNT_AUTOMOUNTED) == 0) {
> +           errno = ENOENT;     /* disinformation */
> +           ret = -1;
> +           goto bail;
> +       }
> +       /* autofs might did the mount under us, accept. */
> +       p->fts_dev = sb.st_dev;
> +       p->fts_ino == sb.st_ino;
>     }
>     ret = fchdir(newfd);
>  bail:
> 
> 
> 
> 
> 


   /* autofs might did the mount under us, accept. */


I’m not native English so forgive me my question. But what does this comment mean?

Regards,
Ronald.