diff mbox series

[3/4] common/rc: fix detection of device-mapper/persistent memory incompatibility

Message ID 161472737079.3478298.2584850499235911991.stgit@magnolia (mailing list archive)
State Accepted
Headers show
Series fstests: various fixes | expand

Commit Message

Darrick J. Wong March 2, 2021, 11:22 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

In commit fc7b3903, we tried to make _require_dm_target smart enough to
_notrun tests that require a device mapper target that isn't compatible
with "DAX".  However, as of this writing, the incompatibility stems from
device mapper's unwillingness to switch access modes when running atop
DAX (persistent memory) devices, and has nothing to do with the
filesystem mount options.

Since filesystems supporting DAX don't universally require "dax" in the
mount options to enable that functionality, switch the test to query
sysfs to see if the scratch device supports DAX.

Fixes: fc7b3903 ("dax/dm: disable testing on devices that don't support dax")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 common/rc |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Chandan Babu R March 5, 2021, 8:25 a.m. UTC | #1
On 03 Mar 2021 at 04:52, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> In commit fc7b3903, we tried to make _require_dm_target smart enough to
> _notrun tests that require a device mapper target that isn't compatible
> with "DAX".  However, as of this writing, the incompatibility stems from
> device mapper's unwillingness to switch access modes when running atop
> DAX (persistent memory) devices, and has nothing to do with the
> filesystem mount options.
>
> Since filesystems supporting DAX don't universally require "dax" in the
> mount options to enable that functionality, switch the test to query
> sysfs to see if the scratch device supports DAX.

Looks good to me.

Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>

>
> Fixes: fc7b3903 ("dax/dm: disable testing on devices that don't support dax")
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  common/rc |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
>
> diff --git a/common/rc b/common/rc
> index 7254130f..10e5f40b 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -1889,7 +1889,8 @@ _require_dm_target()
>  	_require_sane_bdev_flush $SCRATCH_DEV
>  	_require_command "$DMSETUP_PROG" dmsetup
>  
> -	_normalize_mount_options | egrep -q "dax(=always| |$)"
> +	_normalize_mount_options | egrep -q "dax(=always| |$)" || \
> +			test -e "/sys/block/$(_short_dev $SCRATCH_DEV)/dax"
>  	if [ $? -eq 0 ]; then
>  		case $target in
>  		stripe|linear|log-writes)
Christoph Hellwig March 5, 2021, 8:33 a.m. UTC | #2
On Tue, Mar 02, 2021 at 03:22:50PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> In commit fc7b3903, we tried to make _require_dm_target smart enough to
> _notrun tests that require a device mapper target that isn't compatible
> with "DAX".  However, as of this writing, the incompatibility stems from
> device mapper's unwillingness to switch access modes when running atop
> DAX (persistent memory) devices, and has nothing to do with the
> filesystem mount options.
> 
> Since filesystems supporting DAX don't universally require "dax" in the
> mount options to enable that functionality, switch the test to query
> sysfs to see if the scratch device supports DAX.
> 
> Fixes: fc7b3903 ("dax/dm: disable testing on devices that don't support dax")
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index 7254130f..10e5f40b 100644
--- a/common/rc
+++ b/common/rc
@@ -1889,7 +1889,8 @@  _require_dm_target()
 	_require_sane_bdev_flush $SCRATCH_DEV
 	_require_command "$DMSETUP_PROG" dmsetup
 
-	_normalize_mount_options | egrep -q "dax(=always| |$)"
+	_normalize_mount_options | egrep -q "dax(=always| |$)" || \
+			test -e "/sys/block/$(_short_dev $SCRATCH_DEV)/dax"
 	if [ $? -eq 0 ]; then
 		case $target in
 		stripe|linear|log-writes)