All of lore.kernel.org
 help / color / mirror / Atom feed
From: XiaoLi Feng <xifeng@redhat.com>
To: fstests@vger.kernel.org
Cc: djwong@kernel.org, Xiaoli Feng <xifeng@redhat.com>
Subject: [PATCH v2] common/rc: not run swapfile test for DAX
Date: Sun, 25 Apr 2021 00:15:23 +0800	[thread overview]
Message-ID: <20210424161523.4786-1-xifeng@redhat.com> (raw)

From: Xiaoli Feng <xifeng@redhat.com>

DAX doesn't support swapfile. Without this patch,
_require_scratch_swapfile always returns fail for fsdax. Now
change to notrun.

Signed-off-by: Xiaoli Feng <xifeng@redhat.com>
---
 common/rc | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/common/rc b/common/rc
index 11ff7635..c3c40f30 100644
--- a/common/rc
+++ b/common/rc
@@ -2461,8 +2461,13 @@ _require_scratch_swapfile()
 	case "$FSTYP" in
 	ext2|ext3|ext4|xfs)
 		if ! swapon "$SCRATCH_MNT/swap" >/dev/null 2>&1; then
-			_scratch_unmount
-			_fail "swapon failed for $FSTYP"
+			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
 		;;
 	*)
@@ -3326,6 +3331,7 @@ _check_s_dax()
 {
 	local target=$1
 	local exp_s_dax=$2
+	local ret=0
 
 	local attributes=$($XFS_IO_PROG -c 'statx -r' $target | awk '/stat.attributes / { print $3 }')
 
@@ -3347,9 +3353,12 @@ _check_s_dax()
 
 	if [ $exp_s_dax -eq 0 ]; then
 		(( attributes & 0x00200000 )) && echo "$target has unexpected S_DAX flag"
+		(( attributes & 0x00200000 )) && ret=1
 	else
 		(( attributes & 0x00200000 )) || echo "$target doesn't have expected S_DAX flag"
+		(( attributes & 0x00200000 )) || ret=2
 	fi
+	return $ret
 }
 
 _check_xflag()
-- 
2.18.1


             reply	other threads:[~2021-04-24 16:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-24 16:15 XiaoLi Feng [this message]
2021-04-28  4:07 ` [PATCH v2] common/rc: not run swapfile test for DAX Darrick J. Wong

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=20210424161523.4786-1-xifeng@redhat.com \
    --to=xifeng@redhat.com \
    --cc=djwong@kernel.org \
    --cc=fstests@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.