Re: [PATCH 7/8] common/attr: fix _require_noattr2

Darrick J. Wong
2025-10-24T22:15:04Z

On Fri, Oct 24, 2025 at 02:31:16PM +0530, Nirjhar Roy (IBM) wrote:
> On Wed, 2025-10-15 at 09:38 -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > attr2/noattr2 doesn't do anything anymore and aren't reported in
> > /proc/mounts, so we need to check /proc/mounts and _notrun as a result.
> >
> > Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> > ---
> > common/attr | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> >
> > diff --git a/common/attr b/common/attr
> > index 1c1de63e9d5465..35e0bee4e3aa53 100644
> > --- a/common/attr
> > +++ b/common/attr
> > @@ -241,7 +241,11 @@ _require_noattr2()
> > || _fail "_try_scratch_mkfs_xfs failed on $SCRATCH_DEV"
> > _try_scratch_mount -o noattr2 > /dev/null 2>&1 \
> > || _notrun "noattr2 mount option not supported on $SCRATCH_DEV"
> > + grep -w "$SCRATCH_MNT" /proc/mounts | awk '{print $4}' | grep -q -w noattr2
> If noatrr2 doesn't do anything, then in that case _try_scratch_mount will ignore noattr2 and mount
> will succeed. With the above change, we are just checking if noattr2 appears in /proc/mounts(after
> the mount), if yes then the preconditions returns true, else the test using this precondition is
> notrun. Right?

Right.

On a pre-6.18 kernel where noattr2 did something, the following will
happen:

a) V4 filesystem, noattr2 actually matters for the mount, and it should
show up in /proc/mounts. If it doesn't, then the test should not run.

b) V5 filesystem, noattr2 is impossible so the mount fails. Test will
not run.

With 6.18 the behavior changes:

a) V4 filesystem, noattr2 doesn't do anything, the mount succeeds, but
noattr2 does not show up in /proc/mounts. The test should not run.

b) V5 filesystem, noattr2 now no longer fails the mount but it doesn't
show up in /proc/mounts either. The test still should not run.

> This looks okay to me.
> Reviewed-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>

Thanks!

--D

> --NR
> > + local res=${PIPESTATUS[2]}
> > _scratch_unmount
> > + test $res -eq 0 \
> > + || _notrun "noattr2 mount option no longer functional"
> > }
> >
> > # getfattr -R returns info in readdir order which varies from fs to fs.
> >
>
>