2010-05-24 12:04:56 +02:00
|
|
|
#! /bin/bash
|
2018-06-09 11:35:42 +10:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
|
# Copyright (c) 2010 Jan Kara. All Rights Reserved.
|
|
|
|
|
# Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
|
|
|
|
|
#
|
2010-05-24 12:04:56 +02:00
|
|
|
# FS QA Test No. 235
|
|
|
|
|
#
|
|
|
|
|
# Test whether quota gets properly reenabled after remount read-write
|
|
|
|
|
#
|
|
|
|
|
seq=`basename $0`
|
2013-03-15 12:28:02 +00:00
|
|
|
seqres=$RESULT_DIR/$seq
|
2010-05-24 12:04:56 +02:00
|
|
|
echo "QA output created by $seq"
|
|
|
|
|
|
|
|
|
|
here=`pwd`
|
|
|
|
|
tmp=/tmp/$$
|
|
|
|
|
status=1 # failure is the default!
|
|
|
|
|
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
|
|
|
|
|
|
|
|
|
|
# get standard environment, filters and checks
|
2013-03-15 12:28:04 +00:00
|
|
|
. ./common/rc
|
|
|
|
|
. ./common/filter
|
|
|
|
|
. ./common/quota
|
2010-05-24 12:04:56 +02:00
|
|
|
|
|
|
|
|
# real QA test starts here
|
|
|
|
|
_supported_fs generic
|
2017-07-20 21:22:05 -07:00
|
|
|
_supported_os Linux
|
2010-05-24 12:04:56 +02:00
|
|
|
_require_scratch
|
|
|
|
|
_require_quota
|
|
|
|
|
_require_user
|
|
|
|
|
|
2016-07-21 10:55:06 +02:00
|
|
|
do_repquota()
|
|
|
|
|
{
|
|
|
|
|
repquota -u -g $SCRATCH_MNT | grep -v -E '^root|^$' | _filter_scratch
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-24 12:04:56 +02:00
|
|
|
# real QA test starts here
|
2013-03-15 12:28:02 +00:00
|
|
|
rm -f $seqres.full
|
2010-05-24 12:04:56 +02:00
|
|
|
|
2013-03-15 12:28:02 +00:00
|
|
|
_scratch_mkfs >> $seqres.full 2>&1
|
2010-05-24 12:04:56 +02:00
|
|
|
_scratch_mount "-o usrquota,grpquota"
|
|
|
|
|
quotacheck -u -g $SCRATCH_MNT 2>/dev/null
|
|
|
|
|
quotaon $SCRATCH_MNT 2>/dev/null
|
|
|
|
|
|
|
|
|
|
touch $SCRATCH_MNT/testfile
|
|
|
|
|
chown $qa_user:$qa_user $SCRATCH_MNT/testfile
|
|
|
|
|
|
2016-07-21 10:55:06 +02:00
|
|
|
do_repquota
|
2010-05-24 12:04:56 +02:00
|
|
|
|
2013-05-16 06:53:05 -05:00
|
|
|
# If remount fails with this problem:
|
2011-04-04 13:49:19 -05:00
|
|
|
#
|
2013-05-16 06:53:05 -05:00
|
|
|
# https://bugzilla.redhat.com/show_bug.cgi?id=563267
|
|
|
|
|
#
|
|
|
|
|
# then you need a more recent mount binary.
|
2018-02-07 17:31:36 +08:00
|
|
|
_try_scratch_mount "-o remount,ro" 2>&1 | tee -a $seqres.full | _filter_scratch
|
2013-03-15 12:28:02 +00:00
|
|
|
touch $SCRATCH_MNT/failed 2>&1 | tee -a $seqres.full | _filter_scratch
|
2018-02-07 17:31:36 +08:00
|
|
|
_try_scratch_mount "-o remount,rw" 2>&1 | tee -a $seqres.full | _filter_scratch
|
2010-05-24 12:04:56 +02:00
|
|
|
|
2019-11-01 12:00:46 +01:00
|
|
|
touch $SCRATCH_MNT/testfile2
|
|
|
|
|
chown $qa_user:$qa_user $SCRATCH_MNT/testfile2
|
|
|
|
|
|
2016-07-21 10:55:06 +02:00
|
|
|
do_repquota
|
2010-05-24 12:04:56 +02:00
|
|
|
|
2015-12-21 18:07:43 +11:00
|
|
|
_scratch_unmount 2>/dev/null
|
2010-05-24 12:04:56 +02:00
|
|
|
|
|
|
|
|
status=0
|
|
|
|
|
exit
|