Date: Wed, 26 Feb 2025 14:36:57 +0100 (CET) From: Ronald Klop <ronald-lists@klop.ws> To: Konstantin Belousov <kib@FreeBSD.org> Cc: dev-commits-src-all@FreeBSD.org, src-committers@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: e59991206b14 - main - fts(3): be less strict when automount does its job under us walking autofs mount Message-ID: <985139317.7211.1740577017034@localhost> In-Reply-To: <202502250720.51P7KJkI056048@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
------=_Part_7210_1760650439.1740577017031 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Van: Konstantin Belousov <kib@FreeBSD.org> Datum: 25 februari 2025 08:20 Aan: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commi= ts-src-main@FreeBSD.org Onderwerp: git: e59991206b14 - main - fts(3): be less strict when automoun= t does its job under us walking autofs mount >=20 >=20 > The branch main has been updated by kib: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3De59991206b1463b7e85cc8aafd= e7f1dc03fcedcf >=20 > commit e59991206b1463b7e85cc8aafde7f1dc03fcedcf > Author: Konstantin Belousov=20 > AuthorDate: 2025-02-21 13:07:43 +0000 > Commit: Konstantin Belousov=20 > CommitDate: 2025-02-25 07:09:29 +0000 >=20 > fts(3): be less strict when automount does its job under us walking a= utofs mount > =20 > Namely, allow the file id change if the resulting file belongs to > automounted filesystem. If it is, remember the updated id. > =20 > This allows the ids from the automounted volumes to change without > restrictions, might be a further refinement would be to only allow su= ch > inconsistency once. > =20 > PR: 284914 > Reported and tested by: Lexi Winter=20 > 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(-) >=20 > 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; > =20 > newfd =3D fd; > if (ISSET(FTS_NOCHDIR)) > @@ -1144,9 +1145,15 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, cha= r *path) > goto bail; > } > if (p->fts_dev !=3D sb.st_dev || p->fts_ino !=3D sb.st_ino) { > - errno =3D ENOENT; /* disinformation */ > - ret =3D -1; > - goto bail; > + if (_fstatfs(newfd, &sf) !=3D 0 || > + (sf.f_flags & MNT_AUTOMOUNTED) =3D=3D 0) { > + errno =3D ENOENT; /* disinformation */ > + ret =3D -1; > + goto bail; > + } > + /* autofs might did the mount under us, accept. */ > + p->fts_dev =3D sb.st_dev; > + p->fts_ino =3D=3D sb.st_ino; > } > ret =3D fchdir(newfd); > bail: >=20 >=20 >=20 >=20 >=20 /* autofs might did the mount under us, accept. */ I=E2=80=99m not native English so forgive me my question. But what does thi= s comment mean? Regards, Ronald.=20 ------=_Part_7210_1760650439.1740577017031 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <html><head></head><body><br><p><small><strong>Van:</strong> Konstantin Bel= ousov <kib@FreeBSD.org><br><strong>Datum:</strong> 25 februari 2025 0= 8:20<br><strong>Aan:</strong> src-committers@FreeBSD.org, dev-commits-src-a= ll@FreeBSD.org, dev-commits-src-main@FreeBSD.org<br><strong>Onderwerp:</str= ong> git: e59991206b14 - main - fts(3): be less strict when automount does= its job under us walking autofs mount<br></small></p><blockquote style=3D"= margin-left: 5px; border-left: 3px solid #ccc; margin-right: 0px; padding-l= eft: 5px;"><div class=3D"MessageRFC822Viewer do_not_remove" id=3D"P"><!-- P= --> <!-- processMimeMessage --><div class=3D"TextPlainViewer do_not_remove" id= =3D"P.P"><!-- P.P -->The branch main has been updated by kib:<br> <br> URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3De59991206b1463b7e= 85cc8aafde7f1dc03fcedcf">https://cgit.FreeBSD.org/src/commit/?id=3De5999120= 6b1463b7e85cc8aafde7f1dc03fcedcf</a><br> <br> commit e59991206b1463b7e85cc8aafde7f1dc03fcedcf<br> Author: Konstantin Belousov <kib@freebsd.org><br> AuthorDate: 2025-02-21 13:07:43 +0000<br> Commit: Konstantin Belousov <kib@freebsd.org><br> CommitDate: 2025-02-25 07:09:29 +0000<br> <br> fts(3): be less strict when automount does its job = under us walking autofs mount<br> <br> Namely, allow the file id change if the resulting f= ile belongs to<br> automounted filesystem. If it is, remember th= e updated id.<br> <br> This allows the ids from the automounted volumes to= change without<br> restrictions, might be a further refinement would b= e to only allow such<br> inconsistency once.<br> <br> PR: 284914<br> Reported and tested by: Lexi Winter <lexi@hemlock.e= den.le-fay.org><br> Sponsored by: The FreeBSD Foundation<br= > MFC after: 1 week<br> Differential revision: <a href=3D"https://rev= iews.freebsd.org/D49094">https://reviews.freebsd.org/D49094</a><br> ---<br> lib/libc/gen/fts.c | 13 ++++++++++---<br> 1 file changed, 10 insertions(+), 3 deletions(-)<br> <br> diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c<br> index 770a7b2cc322..bd193c7c6cfc 100644<br> --- a/lib/libc/gen/fts.c<br> +++ b/lib/libc/gen/fts.c<br> @@ -1132,6 +1132,7 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, char *= path)<br> {<br> int ret, oerrno, newfd;<br> struct stat sb;<br> + struct statfs sf;<br> <br> newfd =3D fd;<br> if (ISSET(FTS_NOCHDIR))<br> @@ -1144,9 +1145,15 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, char = *path)<br> goto bail;<br> }<br> if (p->fts_dev !=3D sb.st_dev || p->fts_ino != =3D sb.st_ino) {<br> - errno =3D ENOENT; &= nbsp;/* disinformation */<br> - ret =3D -1;<br> - goto bail;<br> + if (_fstatfs(newfd, &sf) !=3D 0 |= |<br> + (sf.f_flags &= amp; MNT_AUTOMOUNTED) =3D=3D 0) {<br> + errno =3D ENO= ENT; /* disinformation */<br> + ret =3D -1;<b= r> + goto bail;<br= > + }<br> + /* autofs might did the mount under u= s, accept. */</lexi@hemlock.eden.le-fay.org></kib@freebsd.org></kib@freebsd= .org></div><div class=3D"TextPlainViewer do_not_remove" id=3D"P.P"><kib@fre= ebsd.org><kib@freebsd.org><lexi@hemlock.eden.le-fay.org> + p->fts_dev =3D sb.st_dev;<br> + p->fts_ino =3D=3D sb.st_ino;<br> }<br> ret =3D fchdir(newfd);<br> bail:<br> <br> </lexi@hemlock.eden.le-fay.org></kib@freebsd.org></kib@freebsd.org></div><!= -- TextPlainViewer --> <hr> </div><!-- MessageRFC822Viewer --> </blockquote><br><br> /* autofs might did the mount under us, a= ccept. */<div><br></div><div><br></div><div>I=E2=80=99m not native English = so forgive me my question. But what does this comment mean?</div><div><br><= /div><div>Regards,</div><div>Ronald. <br><br><br></div></body></html> ------=_Part_7210_1760650439.1740577017031--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?985139317.7211.1740577017034>