public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
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, aalbersh@kernel.org
Subject: Re: [PATCH v2 1/2] generic/772: require filesystem to support file_[g|s]etattr
Date: Thu, 30 Oct 2025 09:03:59 -0700	[thread overview]
Message-ID: <20251030160359.GA6178@frogsfrogsfrogs> (raw)
In-Reply-To: <lwdr5ntyyszcvqe75ljcqtpcrtjioopoa3abm4fjrdupfmrmx7@2jebme2cchx7>

On Thu, Oct 30, 2025 at 04:30:20PM +0100, 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>

Looks good to me,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  common/rc         | 32 ++++++++++++++++++++++++++++++++
>  tests/generic/772 |  4 +---
>  tests/xfs/648     |  6 ++----
>  3 files changed, 35 insertions(+), 7 deletions(-)
> 
> diff --git a/common/rc b/common/rc
> index 462f433197..be3cdd8d64 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -6032,6 +6032,38 @@
>  	esac
>  }
>  
> +# Require filesystem to support file_getattr()/file_setattr() syscalls on
> +# regular files
> +_require_file_attr()
> +{
> +	local test_file="$TEST_DIR/foo"
> +	touch $test_file
> +
> +	$here/src/file_attr --set --set-nodump $TEST_DIR ./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="$TEST_DIR/fifo"
> +	mkfifo $test_file
> +
> +	$here/src/file_attr --set --set-nodump $TEST_DIR ./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 cdadf09ff2..dba1ee7f50 100755
> --- a/tests/generic/772
> +++ b/tests/generic/772
> @@ -17,6 +17,7 @@
>  _require_test_program "file_attr"
>  _require_symlinks
>  _require_mknod
> +_require_file_attr
>  
>  _scratch_mkfs >>$seqres.full 2>&1
>  _scratch_mount
> @@ -43,9 +44,6 @@
>  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 e3c2fbe00b..58e5aa8c5b 100755
> --- a/tests/xfs/648
> +++ b/tests/xfs/648
> @@ -20,7 +20,8 @@
>  _require_test_program "file_attr"
>  _require_symlinks
>  _require_mknod
> -
> +_require_file_attr
> +_require_file_attr_special
>  _scratch_mkfs >>$seqres.full 2>&1
>  _qmount_option "pquota"
>  _scratch_mount
> @@ -47,9 +48,6 @@
>  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 \
> 
> -- 
> - Andrey
> 
> 

  reply	other threads:[~2025-10-30 16:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-30 15:30 [PATCH v2 0/3] generic/772: split and fix Andrey Albershteyn
2025-10-30 15:30 ` [PATCH v2 1/2] generic/772: require filesystem to support file_[g|s]etattr Andrey Albershteyn
2025-10-30 16:03   ` Darrick J. Wong [this message]
2025-11-01  9:11   ` Zorro Lang
2025-10-30 15:30 ` [PATCH v2 2/2] generic/772: split this test into 772 and 779 for regular and special files Andrey Albershteyn

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=20251030160359.GA6178@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