All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHSET 0/3] fstests: fix swapfile tests
@ 2021-04-28  4:09 Darrick J. Wong
  2021-04-28  4:09 ` [PATCH 1/3] xfs/419: remove irrelevant swapfile test Darrick J. Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Darrick J. Wong @ 2021-04-28  4:09 UTC (permalink / raw)
  To: djwong, guaneryu; +Cc: linux-xfs, fstests, guan

Hi all,

Here are a handful of fixes for various swapfile-related regression tests.

If you're going to start using this mess, you probably ought to just
pull from my git trees, which are linked below.

This is an extraordinary way to destroy everything.  Enjoy!
Comments and questions are, as always, welcome.

--D

fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=swapfile-fixes
---
 common/rc         |    8 +++++--
 tests/xfs/419     |   58 -----------------------------------------------------
 tests/xfs/419.out |    5 -----
 tests/xfs/group   |    1 -
 4 files changed, 6 insertions(+), 66 deletions(-)
 delete mode 100755 tests/xfs/419
 delete mode 100644 tests/xfs/419.out


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] xfs/419: remove irrelevant swapfile test
  2021-04-28  4:09 [PATCHSET 0/3] fstests: fix swapfile tests Darrick J. Wong
@ 2021-04-28  4:09 ` Darrick J. Wong
  2021-04-28 18:04   ` Brian Foster
  2021-04-28  4:09 ` [PATCH 2/3] rc: check dax mode in _require_scratch_swapfile Darrick J. Wong
  2021-04-28  4:09 ` [PATCH 3/3] common/rc: relax xfs swapfile support checks Darrick J. Wong
  2 siblings, 1 reply; 8+ messages in thread
From: Darrick J. Wong @ 2021-04-28  4:09 UTC (permalink / raw)
  To: djwong, guaneryu; +Cc: linux-xfs, fstests, guan

From: Darrick J. Wong <djwong@kernel.org>

Since the advent of iomap_swapfile_activate in XFS, we actually /do/
support having swap files on the realtime device.  Remove this test.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/xfs/419     |   58 -----------------------------------------------------
 tests/xfs/419.out |    5 -----
 tests/xfs/group   |    1 -
 3 files changed, 64 deletions(-)
 delete mode 100755 tests/xfs/419
 delete mode 100644 tests/xfs/419.out


diff --git a/tests/xfs/419 b/tests/xfs/419
deleted file mode 100755
index fc7174bd..00000000
--- a/tests/xfs/419
+++ /dev/null
@@ -1,58 +0,0 @@
-#! /bin/bash
-# SPDX-License-Identifier: GPL-2.0
-# Copyright (c) 2017 Oracle, Inc.  All Rights Reserved.
-#
-# FS QA Test No. 419
-#
-# Check that we can't swapon a realtime file.
-#
-seq=`basename $0`
-seqres=$RESULT_DIR/$seq
-echo "QA output created by $seq"
-
-here=`pwd`
-tmp=/tmp/$$
-status=1	# failure is the default!
-trap "_cleanup; exit \$status" 0 1 2 3 7 15
-
-_cleanup()
-{
-	cd /
-	rm -rf $tmp.*
-}
-
-# get standard environment, filters and checks
-. ./common/rc
-. ./common/filter
-
-# real QA test starts here
-_supported_fs xfs
-_require_realtime
-_require_scratch_swapfile
-
-echo "Format and mount"
-_scratch_mkfs > $seqres.full 2>&1
-_scratch_mount >> $seqres.full 2>&1
-
-testdir=$SCRATCH_MNT/test-$seq
-mkdir $testdir
-
-blocks=160
-blksz=65536
-
-echo "Initialize file"
-echo >> $seqres.full
-$XFS_IO_PROG -c "open -f -R $testdir/dummy" $testdir >> $seqres.full
-echo moo >> $testdir/dummy
-$XFS_IO_PROG -c "open -f -R $testdir/file1" $testdir >> $seqres.full
-_pwrite_byte 0x61 0 $((blocks * blksz)) $testdir/file1 >> $seqres.full
-$MKSWAP_PROG -U 27376b42-ff65-42ca-919f-6c9b62292a5c $testdir/file1 >> $seqres.full
-
-echo "Try to swapon"
-swapon $testdir/file1 2>&1 | _filter_scratch
-
-swapoff $testdir/file1 >> $seqres.full 2>&1
-
-# success, all done
-status=0
-exit
diff --git a/tests/xfs/419.out b/tests/xfs/419.out
deleted file mode 100644
index 83b7dd45..00000000
--- a/tests/xfs/419.out
+++ /dev/null
@@ -1,5 +0,0 @@
-QA output created by 419
-Format and mount
-Initialize file
-Try to swapon
-swapon: SCRATCH_MNT/test-419/file1: swapon failed: Invalid argument
diff --git a/tests/xfs/group b/tests/xfs/group
index 76e31167..549209a4 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -407,7 +407,6 @@
 416 dangerous_fuzzers dangerous_scrub dangerous_repair
 417 dangerous_fuzzers dangerous_scrub dangerous_online_repair
 418 dangerous_fuzzers dangerous_scrub dangerous_repair
-419 auto quick swap realtime
 420 auto quick clone punch seek
 421 auto quick clone punch seek
 422 dangerous_scrub dangerous_online_repair


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] rc: check dax mode in _require_scratch_swapfile
  2021-04-28  4:09 [PATCHSET 0/3] fstests: fix swapfile tests Darrick J. Wong
  2021-04-28  4:09 ` [PATCH 1/3] xfs/419: remove irrelevant swapfile test Darrick J. Wong
@ 2021-04-28  4:09 ` Darrick J. Wong
  2021-04-28  4:11   ` Darrick J. Wong
  2021-04-28 18:04   ` Brian Foster
  2021-04-28  4:09 ` [PATCH 3/3] common/rc: relax xfs swapfile support checks Darrick J. Wong
  2 siblings, 2 replies; 8+ messages in thread
From: Darrick J. Wong @ 2021-04-28  4:09 UTC (permalink / raw)
  To: djwong, guaneryu; +Cc: linux-xfs, fstests, guan

From: Darrick J. Wong <djwong@kernel.org>

It turns out that the mm refuses to swapon() files that don't have a
a_ops->readpage function, because it wants to be able to read the swap
header.  S_DAX files don't have a readpage function (though oddly both
ext4 and xfs link to a swapfile activation function in their aops) so
they fail.  The recent commit 725feeff changed this from a _notrun to
_fail on xfs and ext4, so amend this not to fail on pmem test setups.

Fixes: 725feeff ("common/rc: swapon should not fail for given FS in _require_scratch_swapfile()")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 common/rc |    4 ++++
 1 file changed, 4 insertions(+)


diff --git a/common/rc b/common/rc
index 6752c92d..429cc24d 100644
--- a/common/rc
+++ b/common/rc
@@ -2490,6 +2490,10 @@ _require_scratch_swapfile()
 	# Minimum size for mkswap is 10 pages
 	_format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10))
 
+	# swapfiles cannot use cpu direct access mode (STATX_ATTR_DAX) for now
+	statx_attr="$($XFS_IO_PROG -c 'statx -r' $SCRATCH_MNT/swap 2>/dev/null | grep 'stat.attributes = ' | awk '{print $3}')"
+	test "$((statx_attr & 0x200000))" -gt 0 && _notrun "swapfiles not supported on DAX"
+
 	# ext* and xfs have supported all variants of swap files since their
 	# introduction, so swapon should not fail.
 	case "$FSTYP" in


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] common/rc: relax xfs swapfile support checks
  2021-04-28  4:09 [PATCHSET 0/3] fstests: fix swapfile tests Darrick J. Wong
  2021-04-28  4:09 ` [PATCH 1/3] xfs/419: remove irrelevant swapfile test Darrick J. Wong
  2021-04-28  4:09 ` [PATCH 2/3] rc: check dax mode in _require_scratch_swapfile Darrick J. Wong
@ 2021-04-28  4:09 ` Darrick J. Wong
  2021-04-28 18:04   ` Brian Foster
  2 siblings, 1 reply; 8+ messages in thread
From: Darrick J. Wong @ 2021-04-28  4:09 UTC (permalink / raw)
  To: djwong, guaneryu; +Cc: linux-xfs, fstests, guan

From: Darrick J. Wong <djwong@kernel.org>

In commit 725feeff, I forgot that xfs has *not* always supported all
swap file configurations -- the bmap swapfile activation prior to the
introduction of iomap_swapfile_activate did not permit the use of
unwritten extents in the swap file.  Therefore, kick xfs out of the
always-supported list.

Fixes: 725feeff ("common/rc: swapon should not fail for given FS in _require_scratch_swapfile()")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 common/rc |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


diff --git a/common/rc b/common/rc
index 429cc24d..7882355a 100644
--- a/common/rc
+++ b/common/rc
@@ -2494,10 +2494,10 @@ _require_scratch_swapfile()
 	statx_attr="$($XFS_IO_PROG -c 'statx -r' $SCRATCH_MNT/swap 2>/dev/null | grep 'stat.attributes = ' | awk '{print $3}')"
 	test "$((statx_attr & 0x200000))" -gt 0 && _notrun "swapfiles not supported on DAX"
 
-	# ext* and xfs have supported all variants of swap files since their
+	# ext* has supported all variants of swap files since their
 	# introduction, so swapon should not fail.
 	case "$FSTYP" in
-	ext2|ext3|ext4|xfs)
+	ext2|ext3|ext4)
 		if ! swapon "$SCRATCH_MNT/swap" >/dev/null 2>&1; then
 			_scratch_unmount
 			_fail "swapon failed for $FSTYP"


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] rc: check dax mode in _require_scratch_swapfile
  2021-04-28  4:09 ` [PATCH 2/3] rc: check dax mode in _require_scratch_swapfile Darrick J. Wong
@ 2021-04-28  4:11   ` Darrick J. Wong
  2021-04-28 18:04   ` Brian Foster
  1 sibling, 0 replies; 8+ messages in thread
From: Darrick J. Wong @ 2021-04-28  4:11 UTC (permalink / raw)
  To: guaneryu; +Cc: linux-xfs, fstests, guan

On Tue, Apr 27, 2021 at 09:09:41PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> It turns out that the mm refuses to swapon() files that don't have a
> a_ops->readpage function, because it wants to be able to read the swap
> header.  S_DAX files don't have a readpage function (though oddly both
> ext4 and xfs link to a swapfile activation function in their aops) so
> they fail.  The recent commit 725feeff changed this from a _notrun to
> _fail on xfs and ext4, so amend this not to fail on pmem test setups.
> 
> Fixes: 725feeff ("common/rc: swapon should not fail for given FS in _require_scratch_swapfile()")
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>

Note that XiaoLi Feng's patch "common/rc: not run swapfile test for
DAX" is perfectly adequate too, and that patch was sent first.

--D

> ---
>  common/rc |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> 
> diff --git a/common/rc b/common/rc
> index 6752c92d..429cc24d 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -2490,6 +2490,10 @@ _require_scratch_swapfile()
>  	# Minimum size for mkswap is 10 pages
>  	_format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10))
>  
> +	# swapfiles cannot use cpu direct access mode (STATX_ATTR_DAX) for now
> +	statx_attr="$($XFS_IO_PROG -c 'statx -r' $SCRATCH_MNT/swap 2>/dev/null | grep 'stat.attributes = ' | awk '{print $3}')"
> +	test "$((statx_attr & 0x200000))" -gt 0 && _notrun "swapfiles not supported on DAX"
> +
>  	# ext* and xfs have supported all variants of swap files since their
>  	# introduction, so swapon should not fail.
>  	case "$FSTYP" in
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] xfs/419: remove irrelevant swapfile test
  2021-04-28  4:09 ` [PATCH 1/3] xfs/419: remove irrelevant swapfile test Darrick J. Wong
@ 2021-04-28 18:04   ` Brian Foster
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Foster @ 2021-04-28 18:04 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: guaneryu, linux-xfs, fstests, guan

On Tue, Apr 27, 2021 at 09:09:35PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Since the advent of iomap_swapfile_activate in XFS, we actually /do/
> support having swap files on the realtime device.  Remove this test.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  tests/xfs/419     |   58 -----------------------------------------------------
>  tests/xfs/419.out |    5 -----
>  tests/xfs/group   |    1 -
>  3 files changed, 64 deletions(-)
>  delete mode 100755 tests/xfs/419
>  delete mode 100644 tests/xfs/419.out
> 
> 
> diff --git a/tests/xfs/419 b/tests/xfs/419
> deleted file mode 100755
> index fc7174bd..00000000
> --- a/tests/xfs/419
> +++ /dev/null
> @@ -1,58 +0,0 @@
> -#! /bin/bash
> -# SPDX-License-Identifier: GPL-2.0
> -# Copyright (c) 2017 Oracle, Inc.  All Rights Reserved.
> -#
> -# FS QA Test No. 419
> -#
> -# Check that we can't swapon a realtime file.
> -#
> -seq=`basename $0`
> -seqres=$RESULT_DIR/$seq
> -echo "QA output created by $seq"
> -
> -here=`pwd`
> -tmp=/tmp/$$
> -status=1	# failure is the default!
> -trap "_cleanup; exit \$status" 0 1 2 3 7 15
> -
> -_cleanup()
> -{
> -	cd /
> -	rm -rf $tmp.*
> -}
> -
> -# get standard environment, filters and checks
> -. ./common/rc
> -. ./common/filter
> -
> -# real QA test starts here
> -_supported_fs xfs
> -_require_realtime
> -_require_scratch_swapfile
> -
> -echo "Format and mount"
> -_scratch_mkfs > $seqres.full 2>&1
> -_scratch_mount >> $seqres.full 2>&1
> -
> -testdir=$SCRATCH_MNT/test-$seq
> -mkdir $testdir
> -
> -blocks=160
> -blksz=65536
> -
> -echo "Initialize file"
> -echo >> $seqres.full
> -$XFS_IO_PROG -c "open -f -R $testdir/dummy" $testdir >> $seqres.full
> -echo moo >> $testdir/dummy
> -$XFS_IO_PROG -c "open -f -R $testdir/file1" $testdir >> $seqres.full
> -_pwrite_byte 0x61 0 $((blocks * blksz)) $testdir/file1 >> $seqres.full
> -$MKSWAP_PROG -U 27376b42-ff65-42ca-919f-6c9b62292a5c $testdir/file1 >> $seqres.full
> -
> -echo "Try to swapon"
> -swapon $testdir/file1 2>&1 | _filter_scratch
> -
> -swapoff $testdir/file1 >> $seqres.full 2>&1
> -
> -# success, all done
> -status=0
> -exit
> diff --git a/tests/xfs/419.out b/tests/xfs/419.out
> deleted file mode 100644
> index 83b7dd45..00000000
> --- a/tests/xfs/419.out
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -QA output created by 419
> -Format and mount
> -Initialize file
> -Try to swapon
> -swapon: SCRATCH_MNT/test-419/file1: swapon failed: Invalid argument
> diff --git a/tests/xfs/group b/tests/xfs/group
> index 76e31167..549209a4 100644
> --- a/tests/xfs/group
> +++ b/tests/xfs/group
> @@ -407,7 +407,6 @@
>  416 dangerous_fuzzers dangerous_scrub dangerous_repair
>  417 dangerous_fuzzers dangerous_scrub dangerous_online_repair
>  418 dangerous_fuzzers dangerous_scrub dangerous_repair
> -419 auto quick swap realtime
>  420 auto quick clone punch seek
>  421 auto quick clone punch seek
>  422 dangerous_scrub dangerous_online_repair
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] rc: check dax mode in _require_scratch_swapfile
  2021-04-28  4:09 ` [PATCH 2/3] rc: check dax mode in _require_scratch_swapfile Darrick J. Wong
  2021-04-28  4:11   ` Darrick J. Wong
@ 2021-04-28 18:04   ` Brian Foster
  1 sibling, 0 replies; 8+ messages in thread
From: Brian Foster @ 2021-04-28 18:04 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: guaneryu, linux-xfs, fstests, guan

On Tue, Apr 27, 2021 at 09:09:41PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> It turns out that the mm refuses to swapon() files that don't have a
> a_ops->readpage function, because it wants to be able to read the swap
> header.  S_DAX files don't have a readpage function (though oddly both
> ext4 and xfs link to a swapfile activation function in their aops) so
> they fail.  The recent commit 725feeff changed this from a _notrun to
> _fail on xfs and ext4, so amend this not to fail on pmem test setups.
> 
> Fixes: 725feeff ("common/rc: swapon should not fail for given FS in _require_scratch_swapfile()")
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  common/rc |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> 
> diff --git a/common/rc b/common/rc
> index 6752c92d..429cc24d 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -2490,6 +2490,10 @@ _require_scratch_swapfile()
>  	# Minimum size for mkswap is 10 pages
>  	_format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10))
>  
> +	# swapfiles cannot use cpu direct access mode (STATX_ATTR_DAX) for now
> +	statx_attr="$($XFS_IO_PROG -c 'statx -r' $SCRATCH_MNT/swap 2>/dev/null | grep 'stat.attributes = ' | awk '{print $3}')"
> +	test "$((statx_attr & 0x200000))" -gt 0 && _notrun "swapfiles not supported on DAX"
> +
>  	# ext* and xfs have supported all variants of swap files since their
>  	# introduction, so swapon should not fail.
>  	case "$FSTYP" in
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] common/rc: relax xfs swapfile support checks
  2021-04-28  4:09 ` [PATCH 3/3] common/rc: relax xfs swapfile support checks Darrick J. Wong
@ 2021-04-28 18:04   ` Brian Foster
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Foster @ 2021-04-28 18:04 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: guaneryu, linux-xfs, fstests, guan

On Tue, Apr 27, 2021 at 09:09:47PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> In commit 725feeff, I forgot that xfs has *not* always supported all
> swap file configurations -- the bmap swapfile activation prior to the
> introduction of iomap_swapfile_activate did not permit the use of
> unwritten extents in the swap file.  Therefore, kick xfs out of the
> always-supported list.
> 
> Fixes: 725feeff ("common/rc: swapon should not fail for given FS in _require_scratch_swapfile()")
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  common/rc |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> 
> diff --git a/common/rc b/common/rc
> index 429cc24d..7882355a 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -2494,10 +2494,10 @@ _require_scratch_swapfile()
>  	statx_attr="$($XFS_IO_PROG -c 'statx -r' $SCRATCH_MNT/swap 2>/dev/null | grep 'stat.attributes = ' | awk '{print $3}')"
>  	test "$((statx_attr & 0x200000))" -gt 0 && _notrun "swapfiles not supported on DAX"
>  
> -	# ext* and xfs have supported all variants of swap files since their
> +	# ext* has supported all variants of swap files since their
>  	# introduction, so swapon should not fail.
>  	case "$FSTYP" in
> -	ext2|ext3|ext4|xfs)
> +	ext2|ext3|ext4)
>  		if ! swapon "$SCRATCH_MNT/swap" >/dev/null 2>&1; then
>  			_scratch_unmount
>  			_fail "swapon failed for $FSTYP"
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-04-28 18:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28  4:09 [PATCHSET 0/3] fstests: fix swapfile tests Darrick J. Wong
2021-04-28  4:09 ` [PATCH 1/3] xfs/419: remove irrelevant swapfile test Darrick J. Wong
2021-04-28 18:04   ` Brian Foster
2021-04-28  4:09 ` [PATCH 2/3] rc: check dax mode in _require_scratch_swapfile Darrick J. Wong
2021-04-28  4:11   ` Darrick J. Wong
2021-04-28 18:04   ` Brian Foster
2021-04-28  4:09 ` [PATCH 3/3] common/rc: relax xfs swapfile support checks Darrick J. Wong
2021-04-28 18:04   ` Brian Foster

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.