diff mbox

dmflakey: filter out 'dax' from mount options

Message ID x49610gq180.fsf@segfault.boston.devel.redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Moyer Dec. 2, 2015, 4:11 p.m. UTC
Hi,

In testing with MOUNT_OPTIONS="-o dax" ./check ..., I ran into issues
with every single test that uses dmflakey.  The problem is that the
mount will fail, since we're layering a stacking driver on top of the
pmem device, and that stacking driver does not support direct access.
To fix that, I decided to filter out the dax mount option from dmflakey
mounts.  If there are suggestions for a better approach, I'm all ears.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Dave Chinner Dec. 2, 2015, 8:04 p.m. UTC | #1
On Wed, Dec 02, 2015 at 11:11:59AM -0500, Jeff Moyer wrote:
> Hi,
> 
> In testing with MOUNT_OPTIONS="-o dax" ./check ..., I ran into issues
> with every single test that uses dmflakey.  The problem is that the
> mount will fail, since we're layering a stacking driver on top of the
> pmem device, and that stacking driver does not support direct access.
> To fix that, I decided to filter out the dax mount option from dmflakey
> mounts.  If there are suggestions for a better approach, I'm all ears.
> 
> Signed-off-by: Jeff Moyer <jmoyer@redhat.com>

These tests don't run on a ram disk because of the
_require_sane_bdev_flush() check in each of these dm-flakey tests
and so none of my DAX testing has tripped over this...

Because dm-flakey will not alow you to use DAX, there's not much
point in running these tests if the DAX mount option is enabled.
Hence I'd just add this to common/dm-flakey:

echo $MOUNT_OPTIONS | grep -q dax
if [ $? -ne 0 ]; then
	_notrun "Cannot run tests with DAX on dmflakey devices"
fi

That way we have a clear reminder that these tests do not run with
DAX enabled and hence we are not doing crash integrity testing using
dm-flakey on DAX devices....

Cheers,

Dave.
Jeff Moyer Dec. 2, 2015, 9:41 p.m. UTC | #2
Dave Chinner <david@fromorbit.com> writes:

> Because dm-flakey will not alow you to use DAX, there's not much
> point in running these tests if the DAX mount option is enabled.
> Hence I'd just add this to common/dm-flakey:
>
> echo $MOUNT_OPTIONS | grep -q dax
> if [ $? -ne 0 ]; then
> 	_notrun "Cannot run tests with DAX on dmflakey devices"
> fi
>
> That way we have a clear reminder that these tests do not run with
> DAX enabled and hence we are not doing crash integrity testing using
> dm-flakey on DAX devices....

Yes, that makes more sense.  Or, I guess I could add dax support to
dm-flakey.

-Jeff
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/common/dmflakey b/common/dmflakey
index e55aefd..693d231 100644
--- a/common/dmflakey
+++ b/common/dmflakey
@@ -21,6 +21,47 @@ 
 FLAKEY_ALLOW_WRITES=0
 FLAKEY_DROP_WRITES=1
 
+_filter_mount_opt()
+{
+	local opts=''
+	local old_opts=$1
+	local filter=$2
+
+	# If there are no options, or if the filter isn't present,
+	# just return.
+	if [ -z "$old_opts" ]; then
+		echo -n ""
+		return
+	fi
+
+	echo $old_opts | grep -q $filter
+	if [ $? -ne 0 ]; then
+		echo -n $old_opts
+		return
+	fi
+
+	# -o, --options opts
+	#      Options are specified with a -o flag followed by a  comma  sepa-
+	#      rated string of options. For example:
+	#             mount LABEL=mydisk -o noatime,nouser
+	#
+	# There are several cases we have to handle:
+	# -o dax; -o,dax
+	# -o,ro,dax; -o,dax,ro
+	# -o,ro,dax,discard
+	#
+	opts=$(echo $old_opts | sed -e "s/$filter//g")
+	opts=$(echo $opts | sed -e 's/,,/,/g')
+	opts=$(echo $opts | sed -e 's/ ,/ /g')
+	# get rid of trailing whitespace or comma
+	opts=$(echo $opts | sed -e 's/[[:space:]]$//g')
+	opts=$(echo $opts | sed -e 's/,$//g')
+	# finally, if there's nothing left, get rid of the -o
+	opts=$(echo $opts | sed -e 's/-o$//g')
+
+	echo -n $opts
+}
+
 _init_flakey()
 {
 	local BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
@@ -34,7 +75,8 @@  _init_flakey()
 
 _mount_flakey()
 {
-	mount -t $FSTYP $MOUNT_OPTIONS $FLAKEY_DEV $SCRATCH_MNT
+	mount_options=$(_filter_mount_opt "$MOUNT_OPTIONS" dax)
+	mount -t $FSTYP $mount_options $FLAKEY_DEV $SCRATCH_MNT
 }
 
 _unmount_flakey()