[PATCH 2/3] rc: check dax mode in _require_scratch_swapfile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <djwong@xxxxxxxxxx>

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@xxxxxxxxxx>
---
 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




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux