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

Zorro Lang
2025-10-17T17:13:33Z

On Wed, Oct 15, 2025 at 09:38:32AM -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

How about use findmnt? e.g.

grep -qw noattr2 <(findmnt -rncv -M / -o OPTIONS)

> + local res=${PIPESTATUS[2]}

Then the PIPESTATUS isn't needed either.

I can help to do this change if you agree.

Thanks,
Zorro

> _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.
>