public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: guaneryu@gmail.com
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me
Subject: Re: [PATCH 2/3] rc: check dax mode in _require_scratch_swapfile
Date: Tue, 27 Apr 2021 21:11:18 -0700	[thread overview]
Message-ID: <20210428041118.GF1251862@magnolia> (raw)
In-Reply-To: <161958298115.3452499.907986597475080875.stgit@magnolia>

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
> 

  reply	other threads:[~2021-04-28  4:11 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 ` [PATCH 2/3] rc: check dax mode in _require_scratch_swapfile Darrick J. Wong
2021-04-28  4:11   ` Darrick J. Wong [this message]
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=20210428041118.GF1251862@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox