Merge of master-melb:xfs-cmds:28443a by kenmcd.
Put _qmount_option into common.quota for other quota tests to use.
}
-
-#ensures only one quota mount option is specified
-_qmount_option()
-{
- #replace any user defined quota options
- export MOUNT_OPTIONS=`echo $MOUNT_OPTIONS \
- | sed -e 's/uquota/$q_opt/g' \
- -e 's/gquota/$q_opt/g' \
- -e 's/pquota/$q_opt/g' \
- -e 's/quota/$q_opt/g' \
- -e 's/uqnoenforce/$q_opt/g' \
- -e 's/gqnoenforce/$q_opt/g' \
- -e 's/pqnoenforce/$q_opt/g' \
- -e 's/qnoenforce/$q_opt/g' \
- | sed 's/$q_opt/'$1'/g'`
-
- #check $q_opt is in new mount options
- echo $MOUNT_OPTIONS | grep "$1" > /dev/null 2>&1
- [ "$?" -eq 0 ] || export MOUNT_OPTIONS="$MOUNT_OPTIONS -o $1"
-}
-
cat >$tmp.projects <<EOF
1:$SCRATCH_MNT
EOF
_require_nobody
# setup a default run
-if [ -z "$MOUNT_OPTIONS" ]; then
- export MOUNT_OPTIONS="-o uquota"
-fi
+_qmount_option uquota
_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
cat $tmp.mkfs >>$seq.full
}
_scratch_mkfs_xfs $SCRATCH_DEV >/dev/null 2>&1
-export MOUNT_OPTIONS="-o uquota,gquota"
+_qmount_option "uquota,gquota"
_qmount
if src/feature -G $SCRATCH_DEV ; then
:
fi
umount $SCRATCH_MNT 2>/dev/null
-export MOUNT_OPTIONS=""
+_qmount_option "rw" # no quota options
echo "*** Default mount options"
_exercise
-export MOUNT_OPTIONS="-o uquota"
+_qmount_option "uquota"
echo "*** User quota mount option"
_exercise
export MOUNT_OPTIONS="-o gquota"
+_qmount_option "gquota"
echo "*** Group quota mount option"
_exercise
-export MOUNT_OPTIONS="-o uquota,gquota"
+_qmount_option "uquota,gquota"
echo "*** User and Group quota mount options"
_exercise
echo "and using type=$type id=$id" >>$seq.full
}
+#
+# Ensures only the given quota mount option is used
+#
+_qmount_option()
+{
+ # Replace any user defined quota options
+ # with the quota option that we want.
+ # Simplest to do this rather than delete existing ones first because
+ # of the variety of commas and spaces and multiple -o's
+ # that we'd have to cater for. Doesn't matter if we have duplicates.
+ # Use "QUOTA" string so that we don't have any substring confusion
+ # thanks to "quota" which will match with "uquota" and "gquota" etc.
+ export MOUNT_OPTIONS=`echo $MOUNT_OPTIONS \
+ | sed -e 's/uquota/QUOTA/g' \
+ -e 's/gquota/QUOTA/g' \
+ -e 's/pquota/QUOTA/g' \
+ -e 's/quota/QUOTA/g' \
+ -e 's/uqnoenforce/QUOTA/g' \
+ -e 's/gqnoenforce/QUOTA/g' \
+ -e 's/pqnoenforce/QUOTA/g' \
+ -e 's/qnoenforce/QUOTA/g' \
+ -e "s/QUOTA/$1/g"`
+
+ # Ensure we have the given quota option - duplicates are fine
+ export MOUNT_OPTIONS="$MOUNT_OPTIONS -o $1"
+ echo "MOUNT_OPTIONS = $MOUNT_OPTIONS" >>$seq.full
+}
+
# make sure this script returns success
/bin/true