From: "Darrick J. Wong" <djwong@kernel.org>
To: Amir Goldstein <amir73il@gmail.com>
Cc: "Zorro Lang" <zlang@redhat.com>,
"Miklos Szeredi" <miklos@szeredi.hu>,
"Christian Brauner" <brauner@kernel.org>,
"André Almeida" <andrealmeid@igalia.com>,
linux-unionfs@vger.kernel.org, fstests@vger.kernel.org
Subject: Re: [PATCH 1/3] fstests: add helper _scratch_shutdown_and_syncfs
Date: Tue, 10 Jun 2025 07:37:18 -0700 [thread overview]
Message-ID: <20250610143718.GA6143@frogsfrogsfrogs> (raw)
In-Reply-To: <20250609151915.2638057-2-amir73il@gmail.com>
On Mon, Jun 09, 2025 at 05:19:13PM +0200, Amir Goldstein wrote:
> Test xfs/546 has to chain syncfs after shutdown and cannot
> use the _scratch_shitdown helper, because after shutdown a fd
shutdown
Though even this typo will age better than the original ioctl... ;)
> cannot be opened to execute syncfs on.
>
> The xfs_io command of chaining syncfs after shutdown is rather
> more complex to execute in the derived overlayfs test overlay/087.
>
> Add a helper to abstract this complexity from test writers.
> Add a _require statement to match.
>
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
> common/rc | 27 +++++++++++++++++++++++++++
> tests/overlay/087 | 13 +++----------
> tests/xfs/546 | 5 ++---
> 3 files changed, 32 insertions(+), 13 deletions(-)
>
> diff --git a/common/rc b/common/rc
> index f71cc8f0..d9a8b52e 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -595,6 +595,27 @@ _scratch_shutdown_handle()
> fi
> }
>
> +_scratch_shutdown_and_syncfs()
> +{
> + if [ $FSTYP = "overlay" ]; then
> + # In lagacy overlay usage, it may specify directory as
legacy
(Note there's a similar typo in _require_scratch_shutdown itself)
With the typos fixed this looks like a reasonable cleanup
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> + # SCRATCH_DEV, in this case OVL_BASE_SCRATCH_DEV
> + # will be null, so check OVL_BASE_SCRATCH_DEV before
> + # running shutdown to avoid shutting down base fs accidently.
> + if [ -z $OVL_BASE_SCRATCH_DEV ]; then
> + _fail "_scratch_shutdown: call _require_scratch_shutdown first in test"
> + fi
> + # This command is complicated a bit because in the case of overlayfs the
> + # syncfs fd needs to be opened before shutdown and it is different from the
> + # shutdown fd, so we cannot use the _scratch_shutdown() helper.
> + # Filter out xfs_io output of active fds.
> + $XFS_IO_PROG -x -c "open $(_scratch_shutdown_handle)" -c 'shutdown -f ' \
> + -c close -c syncfs $SCRATCH_MNT | grep -vF '[00'
> + else
> + $XFS_IO_PROG -x -c 'shutdown -f ' -c syncfs $SCRATCH_MNT
> + fi
> +}
> +
> _move_mount()
> {
> local mnt=$1
> @@ -4102,6 +4123,12 @@ _require_scratch_shutdown()
> _scratch_unmount
> }
>
> +_require_scratch_shutdown_and_syncfs()
> +{
> + _require_xfs_io_command syncfs
> + _require_scratch_shutdown
> +}
> +
> _check_s_dax()
> {
> local target=$1
> diff --git a/tests/overlay/087 b/tests/overlay/087
> index a5afb0d5..2ad069db 100755
> --- a/tests/overlay/087
> +++ b/tests/overlay/087
> @@ -32,9 +32,8 @@ _begin_fstest auto quick mount shutdown
>
>
> # Modify as appropriate.
> -_require_xfs_io_command syncfs
> _require_scratch_nocheck
> -_require_scratch_shutdown
> +_require_scratch_shutdown_and_syncfs
>
> [ "$OVL_BASE_FSTYP" == "xfs" ] || \
> _notrun "base fs $OVL_BASE_FSTYP has unknown behavior with syncfs after shutdown"
> @@ -43,19 +42,13 @@ _require_scratch_shutdown
> # bother checking the filesystem afterwards since we never wrote anything.
> echo "=== syncfs after shutdown"
> _scratch_mount
> -# This command is complicated a bit because in the case of overlayfs the
> -# syncfs fd needs to be opened before shutdown and it is different from the
> -# shutdown fd, so we cannot use the _scratch_shutdown() helper.
> -# Filter out xfs_io output of active fds.
> -$XFS_IO_PROG -x -c "open $(_scratch_shutdown_handle)" -c 'shutdown -f ' -c close -c syncfs $SCRATCH_MNT | \
> - grep -vF '[00'
> +_scratch_shutdown_and_syncfs
>
> # Now repeat the same test with a volatile overlayfs mount and expect no error
> _scratch_unmount
> echo "=== syncfs after shutdown (volatile)"
> _scratch_mount -o volatile
> -$XFS_IO_PROG -x -c "open $(_scratch_shutdown_handle)" -c 'shutdown -f ' -c close -c syncfs $SCRATCH_MNT | \
> - grep -vF '[00'
> +_scratch_shutdown_and_syncfs
>
> # success, all done
> status=0
> diff --git a/tests/xfs/546 b/tests/xfs/546
> index 316ffc50..c50d41a6 100755
> --- a/tests/xfs/546
> +++ b/tests/xfs/546
> @@ -27,14 +27,13 @@ _begin_fstest auto quick shutdown
>
>
> # Modify as appropriate.
> -_require_xfs_io_command syncfs
> _require_scratch_nocheck
> -_require_scratch_shutdown
> +_require_scratch_shutdown_and_syncfs
>
> # Reuse the fs formatted when we checked for the shutdown ioctl, and don't
> # bother checking the filesystem afterwards since we never wrote anything.
> _scratch_mount
> -$XFS_IO_PROG -x -c 'shutdown -f ' -c syncfs $SCRATCH_MNT
> +_scratch_shutdown_and_syncfs
>
> # success, all done
> status=0
> --
> 2.34.1
>
>
next prev parent reply other threads:[~2025-06-10 14:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-09 15:19 [PATCH 0/3] fstests overlay updates for 6.16-rc1 Amir Goldstein
2025-06-09 15:19 ` [PATCH 1/3] fstests: add helper _scratch_shutdown_and_syncfs Amir Goldstein
2025-06-10 14:37 ` Darrick J. Wong [this message]
2025-06-18 15:18 ` Zorro Lang
2025-06-09 15:19 ` [PATCH 2/3] fstests: add helper _require_xfs_io_shutdown Amir Goldstein
2025-06-09 20:20 ` André Almeida
2025-06-10 14:42 ` Darrick J. Wong
2025-06-10 18:34 ` Amir Goldstein
2025-06-10 19:02 ` Darrick J. Wong
2025-06-18 15:20 ` Zorro Lang
2025-06-09 15:19 ` [PATCH 3/3] overlay/08[89]: add tests for data-only redirect with userxattr Amir Goldstein
2025-06-18 16:02 ` Zorro Lang
2025-06-18 18:46 ` Amir Goldstein
2025-06-10 18:00 ` [PATCH 0/3] fstests overlay updates for 6.16-rc1 André Almeida
2025-06-10 18:25 ` Amir Goldstein
2025-06-18 14:56 ` Zorro Lang
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=20250610143718.GA6143@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=amir73il@gmail.com \
--cc=andrealmeid@igalia.com \
--cc=brauner@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
--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