* [patch] dmflakey: filter out 'dax' from mount options
@ 2015-12-02 16:11 Jeff Moyer
2015-12-02 20:04 ` Dave Chinner
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Moyer @ 2015-12-02 16:11 UTC (permalink / raw)
To: fstests
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>
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()
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [patch] dmflakey: filter out 'dax' from mount options
2015-12-02 16:11 [patch] dmflakey: filter out 'dax' from mount options Jeff Moyer
@ 2015-12-02 20:04 ` Dave Chinner
2015-12-02 21:41 ` Jeff Moyer
0 siblings, 1 reply; 3+ messages in thread
From: Dave Chinner @ 2015-12-02 20:04 UTC (permalink / raw)
To: Jeff Moyer; +Cc: fstests
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.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] dmflakey: filter out 'dax' from mount options
2015-12-02 20:04 ` Dave Chinner
@ 2015-12-02 21:41 ` Jeff Moyer
0 siblings, 0 replies; 3+ messages in thread
From: Jeff Moyer @ 2015-12-02 21:41 UTC (permalink / raw)
To: Dave Chinner; +Cc: fstests
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-12-02 21:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-02 16:11 [patch] dmflakey: filter out 'dax' from mount options Jeff Moyer
2015-12-02 20:04 ` Dave Chinner
2015-12-02 21:41 ` Jeff Moyer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox