All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: fstests@vger.kernel.org
Subject: [PATCH 08/12] generic/081: don't run on DAX capable devices
Date: Tue, 17 May 2022 17:01:07 +1000	[thread overview]
Message-ID: <20220517070111.1381936-9-david@fromorbit.com> (raw)
In-Reply-To: <20220517070111.1381936-1-david@fromorbit.com>

From: Dave Chinner <dchinner@redhat.com>

LVM/DM has conniptions when you try to use snapshots on a device
that has DAX capability. It first sets up the underlying device as a
DAX capable mapping (type 3 or DM_TYPE_DAX_BIO_BASED) but because
snapshots require COW and shared mappings, it isn't supported on DAX
capable devices. Hence creating the snapshot device fails because it
requires a type 1 (DM_TYPE_BIO_BASED) device and DM can't change
types on a loaded mapping.

Hence we get this obscure error message in the log:

device-mapper: ioctl: can't change device type (old=3 vs new=1) after initial table load.

and these obscure, unhelpful error messages from the LVM command
outputs:

  device-mapper: reload ioctl on  (251:0) failed: Invalid argument
  Failed to suspend logical volume vg_081/base_081.
  Device vg_081-base_081-real (251:1) is used by another device.
  Failed to revert logical volume vg_081/base_081.
  Aborting. Manual intervention required.
Failed to create snapshot

How to turn off DAX capability is not documented in dmsetup or LVM
man pages, nor is dax mentioned anywhere in
Documentation/admin/device-mapper/ so I have no idea how to tell
LVM/DM "don't try to enable DAX support!".

As such, if the uderlying block device is dax capable, skip this
test.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 common/rc | 33 +++++++++++++++++++++++----------
 1 file changed, 23 insertions(+), 10 deletions(-)

diff --git a/common/rc b/common/rc
index 4201a059..f5ead044 100644
--- a/common/rc
+++ b/common/rc
@@ -2167,7 +2167,7 @@ _require_sane_bdev_flush()
 #	3. "dax=inode" or nothing means "use scratch dev capability" to
 #	    determine whether DAX is going to be used.
 #
-# Returns 0 if DAX will be used, 1 if DAX is not going to be used.
+# Returns 0 if the filesytem will use DAX, 1 if it won't.
 __scratch_uses_fsdax()
 {
 	local ops=$(_normalize_mount_options "$MOUNT_OPTIONS")
@@ -2175,9 +2175,19 @@ __scratch_uses_fsdax()
 	echo $ops | egrep -qw "dax(=always| |$)" && return 0
 	echo $ops | grep -qw "dax=never" && return 1
 
+	return 0
+}
+
+# Determine if the scratch device is DAX capable. Every if the fs is not
+# using DAX, we still can't use certain device mapper targets if the block
+# device is DAX capable. hence the check needs to be separat from the FS
+# capability.
+__scratch_dev_has_dax()
+{
 	local sysfs="/sys/block/$(_short_dev $SCRATCH_DEV)"
 	test -e "${sysfs}/dax" && return 0
 	test "$(cat "${sysfs}/queue/dax" 2>/dev/null)" = "1" && return 0
+
 	return 1
 }
 
@@ -2194,15 +2204,18 @@ _require_dm_target()
 	_require_sane_bdev_flush $SCRATCH_DEV
 	_require_command "$DMSETUP_PROG" dmsetup
 
-	if __scratch_uses_fsdax; then
-		case $target in
-		stripe|linear|log-writes)
-			;;
-		*)
-			_notrun "Cannot run tests with DAX on $target devices."
-			;;
-		esac
-	fi
+	case $target in
+	stripe|linear|log-writes)
+		;;
+	*)
+		if __scratch_uses_fsdax; then
+			_notrun "Cannot run tests with fsdax on $target devices."
+		fi
+		if __scratch_dev_has_dax; then
+			_notrun "Cannot use $target devices on DAX capable block devices."
+		fi
+		;;
+	esac
 
 	modprobe dm-$target >/dev/null 2>&1
 
-- 
2.35.1


  parent reply	other threads:[~2022-05-17  7:02 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17  7:00 [PATCH 00/13 V2] fstests: fixes and more fixes Dave Chinner
2022-05-17  7:01 ` [PATCH 01/12] fstests: filter quota warnings Dave Chinner
2022-05-17  7:01 ` [PATCH 02/12] xfs/122: add attribute log formats to test output Dave Chinner
2022-05-17  7:01 ` [PATCH 03/12] xfs/348: golden output is not correct Dave Chinner
2022-05-17  7:01 ` [PATCH 04/12] fstests: fix group list generation for whacky test names Dave Chinner
2022-05-19 18:52   ` Darrick J. Wong
2022-05-20  8:36   ` Zorro Lang
2022-05-20  8:54     ` Zorro Lang
2022-05-20  9:25       ` Zorro Lang
2022-05-20 16:23         ` Darrick J. Wong
2022-05-21  0:27           ` Zorro Lang
2022-05-17  7:01 ` [PATCH 05/12] README: document _begin_fstests better Dave Chinner
2022-05-19 23:13   ` Darrick J. Wong
2022-05-20  1:58     ` Dave Chinner
2022-05-20  2:02       ` Darrick J. Wong
2022-05-20  5:23         ` Zorro Lang
2022-05-20  5:42           ` Dave Chinner
2022-05-20  6:16             ` Zorro Lang
2022-05-17  7:01 ` [PATCH 06/12] xfs/148: make test debuggable Dave Chinner
2022-05-19 18:55   ` Darrick J. Wong
2022-05-17  7:01 ` [PATCH 07/12] xfs/148: fix failure from bad shortform size assumptions Dave Chinner
2022-05-20  7:34   ` Zorro Lang
2022-05-21 23:22     ` Dave Chinner
2022-05-17  7:01 ` Dave Chinner [this message]
2022-05-18  5:11   ` [PATCH 08/12] generic/081: don't run on DAX capable devices Dave Chinner
2022-05-17  7:01 ` [PATCH 12/12] xfs/191: remove broken test Dave Chinner
2022-05-19 18:55   ` Darrick J. Wong
2022-05-17  7:49 ` [PATCH 00/13 V2] fstests: fixes and more fixes Dave Chinner
2022-05-17  8:24   ` Zorro Lang
2022-05-17 21:39     ` Dave Chinner

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=20220517070111.1381936-9-david@fromorbit.com \
    --to=david@fromorbit.com \
    --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.