From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org, guaneryu@gmail.com
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me
Subject: [PATCH 2/3] rc: check dax mode in _require_scratch_swapfile
Date: Tue, 27 Apr 2021 21:09:41 -0700 [thread overview]
Message-ID: <161958298115.3452499.907986597475080875.stgit@magnolia> (raw)
In-Reply-To: <161958296906.3452499.12678290296714187590.stgit@magnolia>
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
next prev parent reply other threads:[~2021-04-28 4:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Darrick J. Wong [this message]
2021-04-28 4:11 ` [PATCH 2/3] rc: check dax mode in _require_scratch_swapfile 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
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=161958298115.3452499.907986597475080875.stgit@magnolia \
--to=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=guan@eryu.me \
--cc=guaneryu@gmail.com \
--cc=linux-xfs@vger.kernel.org \
/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 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.