From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> 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@xxxxxxxxxx> --- 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= -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html