[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251112222920.GO196358@frogsfrogsfrogs>
Date: Wed, 12 Nov 2025 14:29:20 -0800
From: "Darrick J. Wong" <djwong@...nel.org>
To: Theodore Ts'o <tytso@....edu>
Cc: Baokun Li <libaokun1@...wei.com>, zlang@...hat.com, neal@...pa.dev,
fstests@...r.kernel.org, linux-ext4@...r.kernel.org,
linux-fsdevel@...r.kernel.org, joannelkoong@...il.com,
bernd@...ernd.com
Subject: [PATCH v6.1 04/33] common/rc: skip test if swapon doesn't work
From: Darrick J. Wong <djwong@...nel.org>
In _require_scratch_swapfile, skip the test if swapon fails for whatever
reason, just like all the other filesystems. There are certain ext4
configurations where swapon isn't supported, such as S_DAX files on
pmem, and (for now) blocksize > pagesize filesystems.
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
v6.1: clobber all the ext-specific stuff
---
common/rc | 25 ++++---------------------
1 file changed, 4 insertions(+), 21 deletions(-)
diff --git a/common/rc b/common/rc
index b62e21f778d938..564235ea2e995c 100644
--- a/common/rc
+++ b/common/rc
@@ -3268,27 +3268,10 @@ _require_scratch_swapfile()
# Minimum size for mkswap is 10 pages
_format_swapfile "$SCRATCH_MNT/swap" $(($(_get_page_size) * 10)) > /dev/null
- # ext* has supported all variants of swap files since their
- # introduction, so swapon should not fail.
- case "$FSTYP" in
- ext2|ext3|ext4)
- if ! swapon "$SCRATCH_MNT/swap" >/dev/null 2>&1; then
- if _check_s_dax "$SCRATCH_MNT/swap" 1 >/dev/null; then
- _scratch_unmount
- _notrun "swapfiles are not supported"
- else
- _scratch_unmount
- _fail "swapon failed for $FSTYP"
- fi
- fi
- ;;
- *)
- if ! swapon "$SCRATCH_MNT/swap" >/dev/null 2>&1; then
- _scratch_unmount
- _notrun "swapfiles are not supported"
- fi
- ;;
- esac
+ if ! swapon "$SCRATCH_MNT/swap" >/dev/null 2>&1; then
+ _scratch_unmount
+ _notrun "swapon failed for $FSTYP"
+ fi
swapoff "$SCRATCH_MNT/swap" >/dev/null 2>&1
_scratch_unmount
Powered by blists - more mailing lists