All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: guaneryu@gmail.com, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Subject: [PATCH 4/7] xfs: filter out mount options that don't work on v4 filesystems
Date: Tue, 03 Jul 2018 21:51:12 -0700	[thread overview]
Message-ID: <153067987261.28393.13229691209356951536.stgit@magnolia> (raw)
In-Reply-To: <153067984748.28393.1595618163831671652.stgit@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

A few tests require v4 filesystems and enforce this by disabling crc's
in the _scratch_mkfs call.  However, if the user specified MOUNT_OPTIONS
that only work with v5 filesystems, these tests fail.  Filter out
incompatible mount options that don't work on v4, such as simultaneous
group/project quota.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/xfs    |   23 +++++++++++++++++++++++
 tests/xfs/002 |    2 ++
 tests/xfs/194 |    2 ++
 tests/xfs/199 |    2 ++
 4 files changed, 29 insertions(+)


diff --git a/common/xfs b/common/xfs
index 5b632df1..33d819d7 100644
--- a/common/xfs
+++ b/common/xfs
@@ -780,3 +780,26 @@ _scratch_get_bmx_prefix() {
 	_scratch_xfs_db -c "inode ${ino}" -c 'p' >> $seqres.full
 	return 1
 }
+
+#
+# Ensures that we don't pass any mount options incompatible with XFS v4
+#
+_filter_xfsv4_mount_options()
+{
+	local gquota=0
+	local pquota=0
+
+	# Can't have group and project quotas in XFS v4
+	echo "$MOUNT_OPTIONS" | egrep -q "(gquota|grpquota|grpjquota=|gqnoenforce)" && gquota=1
+	echo "$MOUNT_OPTIONS" | egrep -q "(\bpquota|prjquota|pqnoenforce)" && pquota=1
+
+	if [ $gquota -gt 0 ] && [ $pquota -gt 0 ]; then
+		export MOUNT_OPTIONS=$(echo $MOUNT_OPTIONS \
+			| sed   -e 's/gquota/QUOTA/g'      \
+				-e 's/grpquota/QUOTA/g'    \
+				-e 's/grpjquota=[^, ]/QUOTA/g' \
+				-e 's/gqnoenforce/QUOTA/g' \
+				-e "s/QUOTA/defaults/g")
+	fi
+	echo "MOUNT_OPTIONS = $MOUNT_OPTIONS" >>$seqres.full
+}
diff --git a/tests/xfs/002 b/tests/xfs/002
index bd1c0a7a..f987575c 100755
--- a/tests/xfs/002
+++ b/tests/xfs/002
@@ -45,6 +45,8 @@ rm -f $seqres.full
 
 _scratch_mkfs_xfs -m crc=0 -d size=128m >> $seqres.full 2>&1 || _fail "mkfs failed"
 
+_filter_xfsv4_mount_options
+
 # Scribble past a couple V4 secondary superblocks to populate sb_crc
 # (We can't write to the structure member because it doesn't exist
 # on a v4 superblock, so we use the data type & "write fill")
diff --git a/tests/xfs/194 b/tests/xfs/194
index 6c1eddba..09a3840d 100755
--- a/tests/xfs/194
+++ b/tests/xfs/194
@@ -74,6 +74,8 @@ _require_scratch
 unset MKFS_OPTIONS
 unset XFS_MKFS_OPTIONS
 
+_filter_xfsv4_mount_options
+
 # we need 512 byte block size, so crc's are turned off
 _scratch_mkfs_xfs -m crc=0 -b size=$blksize >/dev/null 2>&1
 _scratch_mount
diff --git a/tests/xfs/199 b/tests/xfs/199
index dd909b09..54fe54fe 100755
--- a/tests/xfs/199
+++ b/tests/xfs/199
@@ -34,6 +34,8 @@ _supported_os Linux
 
 _require_scratch
 
+_filter_xfsv4_mount_options
+
 # clear any mkfs options so that we can directly specify the options we need to
 # be able to test the features bitmask behaviour correctly.
 MKFS_OPTIONS=


  parent reply	other threads:[~2018-07-04  4:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-04  4:50 [PATCH 0/7] fstests: fix quota failures on xfs Darrick J. Wong
2018-07-04  4:50 ` [PATCH 1/7] generic/{279, 28[1-3]}: hide SIGBUS reporting from golden output Darrick J. Wong
2018-07-04  4:51 ` [PATCH 2/7] misc: force the exact quota options coded into the test Darrick J. Wong
2018-07-14 10:14   ` Eryu Guan
2018-07-04  4:51 ` [PATCH 3/7] xfs/001: update to handle v5 filesystems Darrick J. Wong
2018-07-04  4:51 ` Darrick J. Wong [this message]
2018-07-14 11:41   ` [PATCH 4/7] xfs: filter out mount options that don't work on v4 filesystems Eryu Guan
2018-11-01 22:51     ` Darrick J. Wong
2018-07-04  4:51 ` [PATCH 5/7] xfs/288: update for v5 filesystem support in xfs_db Darrick J. Wong
2018-07-04  4:51 ` [PATCH 6/7] generic/338: don't check fs after crashing it Darrick J. Wong
2018-07-04  4:51 ` [PATCH 7/7] misc: filter out quota regeneration messages Darrick J. Wong
2018-07-14 11:49 ` [PATCH 0/7] fstests: fix quota failures on xfs Eryu Guan
2018-07-16 14:28   ` Darrick J. Wong

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=153067987261.28393.13229691209356951536.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=fstests@vger.kernel.org \
    --cc=guaneryu@gmail.com \
    --cc=linux-xfs@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.