Re: [PATCH 5/8] generic/772: actually check for file_getattr special file support

Nirjhar Roy (IBM)
2025-10-30T06:06:14Z

On 10/25/25 03:40, Darrick J. Wong wrote:
> On Fri, Oct 24, 2025 at 01:14:29PM +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>
>>>
>>> On XFS in 6.17, this test fails with:
>>>
>>> --- /run/fstests/bin/tests/generic/772.out 2025-10-06 08:27:10.834318149 -0700
>>> +++ /var/tmp/fstests/generic/772.out.bad 2025-10-08 18:00:34.713388178 -0700
>>> @@ -9,29 +9,34 @@ Can not get fsxattr on ./foo: Invalid ar
>>> Can not set fsxattr on ./foo: Invalid argument
>>> Initial attributes state
>>> ----------------- SCRATCH_MNT/prj
>>> ------------------ ./fifo
>>> ------------------ ./chardev
>>> ------------------ ./blockdev
>>> ------------------ ./socket
>>> ------------------ ./foo
>>> ------------------ ./symlink
>>> +Can not get fsxattr on ./fifo: Inappropriate ioctl for device
>>> +Can not get fsxattr on ./chardev: Inappropriate ioctl for device
>>> +Can not get fsxattr on ./blockdev: Inappropriate ioctl for device
>>> +Can not get fsxattr on ./socket: Inappropriate ioctl for device
>>>
>>> This is a result of XFS' file_getattr implementation rejecting special
>>> files prior to 6.18. Therefore, skip this new test on old kernels.
>>>
>>> Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
>>> ---
>>> tests/generic/772 | 3 +++
>>> tests/xfs/648 | 3 +++
>>> 2 files changed, 6 insertions(+)
>>>
>>>
>>> diff --git a/tests/generic/772 b/tests/generic/772
>>> index cc1a1bb5bf655c..e68a6724654450 100755
>>> --- a/tests/generic/772
>>> +++ b/tests/generic/772
>>> @@ -43,6 +43,9 @@ touch $projectdir/bar
>>> ln -s $projectdir/bar $projectdir/broken-symlink
>>> rm -f $projectdir/bar
>>>
>>> +file_attr --get $projectdir ./fifo &>/dev/null || \
>>> + _notrun "file_getattr not supported on $FSTYP"
>>> +
>> Shouldn't we use $here/src/file_attr like we have done later (maybe just for consistency)?
> Probably, but this test has (for now) a wrapper so I used that.

Sorry, which wrapper are you referring to?

>
>> Also, I am wondering if we can have something like
>> _require_get_attr_for_special_files() helper kind of a thing?
> Andrey's working on that.

Okay, thanks.

--NR

>
> --D
>
>> --NR
>>> echo "Error codes"
>>> # wrong AT_ flags
>>> file_attr --get --invalid-at $projectdir ./foo
>>> diff --git a/tests/xfs/648 b/tests/xfs/648
>>> index 215c809887b609..e3c2fbe00b666a 100755
>>> --- a/tests/xfs/648
>>> +++ b/tests/xfs/648
>>> @@ -47,6 +47,9 @@ touch $projectdir/bar
>>> ln -s $projectdir/bar $projectdir/broken-symlink
>>> rm -f $projectdir/bar
>>>
>>> +$here/src/file_attr --get $projectdir ./fifo &>/dev/null || \
>>> + _notrun "file_getattr not supported on $FSTYP"
>>> +
>>> $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
>>> -c "project -sp $projectdir $id" $SCRATCH_DEV | filter_quota
>>> $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
>>>
>>
--
Nirjhar Roy
Linux Kernel Developer
IBM, Bangalore