From: "Darrick J. Wong" <djwong@kernel.org>
To: Andrey Albershteyn <aalbersh@redhat.com>
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org,
zlang@redhat.com, Andrey Albershteyn <aalbersh@kernel.org>
Subject: Re: [PATCH 2/3] generic/772: require filesystem to support file_[g|s]etattr
Date: Mon, 20 Oct 2025 09:45:03 -0700 [thread overview]
Message-ID: <20251020164503.GN6178@frogsfrogsfrogs> (raw)
In-Reply-To: <20251020135530.1391193-3-aalbersh@kernel.org>
On Mon, Oct 20, 2025 at 03:55:29PM +0200, Andrey Albershteyn wrote:
> Add _require_* function to check that filesystem support these syscalls
> on regular and special files.
>
> Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
> ---
> common/rc | 32 ++++++++++++++++++++++++++++++++
> tests/generic/772 | 5 ++---
> tests/xfs/648 | 7 +++----
> 3 files changed, 37 insertions(+), 7 deletions(-)
>
> diff --git a/common/rc b/common/rc
> index dcae5bc33b19..78928c27da97 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -5994,6 +5994,38 @@ _require_inplace_writes()
> fi
> }
>
> +# Require filesystem to support file_getattr()/file_setattr() syscalls on
> +# regular files
> +_require_file_attr()
> +{
> + local test_file="$SCRATCH_MNT/foo"
Should the test file be on $TEST_DIR so that you don't have an implicit
dependency on _require_scratch?
Otherwise looks fine to me.
--D
> + touch $test_file
> +
> + $here/src/file_attr --set --set-nodump $SCRATCH_MNT ./foo &>/dev/null
> + rc=$?
> + rm -f "$test_file"
> +
> + if [ $rc -ne 0 ]; then
> + _notrun "file_getattr not supported for regular files on $FSTYP"
> + fi
> +}
> +
> +# Require filesystem to support file_getattr()/file_setattr() syscalls on
> +# special files (chardev, fifo...)
> +_require_file_attr_special()
> +{
> + local test_file="$SCRATCH_MNT/fifo"
> + mkfifo $test_file
> +
> + $here/src/file_attr --set --set-nodump $SCRATCH_MNT ./fifo &>/dev/null
> + rc=$?
> + rm -f "$test_file"
> +
> + if [ $rc -ne 0 ]; then
> + _notrun "file_getattr not supported for special files on $FSTYP"
> + fi
> +}
> +
> ################################################################################
> # make sure this script returns success
> /bin/true
> diff --git a/tests/generic/772 b/tests/generic/772
> index e68a67246544..bdd55b10f310 100755
> --- a/tests/generic/772
> +++ b/tests/generic/772
> @@ -20,6 +20,8 @@ _require_mknod
>
> _scratch_mkfs >>$seqres.full 2>&1
> _scratch_mount
> +_require_file_attr
> +_require_file_attr_special
>
> file_attr () {
> $here/src/file_attr $*
> @@ -43,9 +45,6 @@ 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"
> -
> echo "Error codes"
> # wrong AT_ flags
> file_attr --get --invalid-at $projectdir ./foo
> diff --git a/tests/xfs/648 b/tests/xfs/648
> index e3c2fbe00b66..a268bfdb0e2d 100755
> --- a/tests/xfs/648
> +++ b/tests/xfs/648
> @@ -20,10 +20,12 @@ _require_test_program "af_unix"
> _require_test_program "file_attr"
> _require_symlinks
> _require_mknod
> -
> _scratch_mkfs >>$seqres.full 2>&1
> _qmount_option "pquota"
> _scratch_mount
> +_require_file_attr
> +_require_file_attr_special
> +
>
> create_af_unix () {
> $here/src/af_unix $* || echo af_unix failed
> @@ -47,9 +49,6 @@ 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 \
> --
> 2.50.1
>
>
next prev parent reply other threads:[~2025-10-20 16:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-20 13:55 [PATCH 0/3] generic/772: split and fix Andrey Albershteyn
2025-10-20 13:55 ` [PATCH 1/3] common/filter: add missing file attribute Andrey Albershteyn
2025-10-20 16:46 ` Darrick J. Wong
2025-10-21 9:42 ` Andrey Albershteyn
2025-10-20 13:55 ` [PATCH 2/3] generic/772: require filesystem to support file_[g|s]etattr Andrey Albershteyn
2025-10-20 16:45 ` Darrick J. Wong [this message]
2025-10-21 9:42 ` Andrey Albershteyn
2025-10-20 13:55 ` [PATCH 3/3] generic/772: split this test into 772 and 773 for regular and special files Andrey Albershteyn
2025-10-20 16:45 ` Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251020164503.GN6178@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=aalbersh@kernel.org \
--cc=aalbersh@redhat.com \
--cc=fstests@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=zlang@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).