mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
Merge branch 'quota-tests' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/xfstests-dev/
This commit is contained in:
@@ -48,7 +48,7 @@ trap "_cleanup ; exit \$status" 0 1 2 3 15
|
||||
. ./common.rc
|
||||
|
||||
# real QA test starts here
|
||||
_supported_fs generic
|
||||
_supported_fs xfs
|
||||
_supported_os Linux
|
||||
|
||||
TDIR="${TEST_DIR}/t_holes"
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
#! /bin/bash
|
||||
# FS QA Test No. 230
|
||||
#
|
||||
# Simple quota enforcement test.
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2010 Jan Kara. All Rights Reserved.
|
||||
#
|
||||
# Based on test 219,
|
||||
# Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it would be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
#
|
||||
# creator
|
||||
owner=jack@suse.cz
|
||||
|
||||
seq=`basename $0`
|
||||
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
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
. ./common.quota
|
||||
|
||||
filter_scratch()
|
||||
{
|
||||
perl -ne "
|
||||
s,$SCRATCH_MNT,[SCR_MNT],;
|
||||
s,$SCRATCH_DEV,[SCR_DEV],;
|
||||
print;"
|
||||
}
|
||||
|
||||
# real QA test starts here
|
||||
_supported_fs generic
|
||||
_supported_os Linux #IRIX
|
||||
_require_scratch
|
||||
_require_quota
|
||||
_require_user
|
||||
_need_to_be_root
|
||||
|
||||
test_files()
|
||||
{
|
||||
echo; echo "### create files, setting up ownership (type=$type)"
|
||||
touch $SCRATCH_MNT/file{1,2} 2>/dev/null
|
||||
chown $qa_user $SCRATCH_MNT/file{1,2} 2>/dev/null
|
||||
chgrp $qa_user $SCRATCH_MNT/file{1,2} 2>/dev/null
|
||||
chmod 777 $SCRATCH_MNT 2>/dev/null
|
||||
}
|
||||
|
||||
test_enforcement()
|
||||
{
|
||||
echo "### some buffered IO (type=$type)"
|
||||
echo "--- initiating IO..." >>$seq.full
|
||||
# Firstly fit below block soft limit
|
||||
echo "Write 900k..."
|
||||
su $qa_user -c "$XFS_IO_PROG -F -c 'pwrite 0 900k' -c fsync \
|
||||
$SCRATCH_MNT/file1" 2>&1 >>$seq.full | tee -a $seq.full
|
||||
repquota -$type $SCRATCH_MNT | grep -v "^root" >>$seq.full 2>&1
|
||||
# Secondly overcome block soft limit
|
||||
echo "Rewrite 1001k..."
|
||||
su $qa_user -c "$XFS_IO_PROG -F -c 'pwrite 0 1001k' -c fsync \
|
||||
$SCRATCH_MNT/file1" 2>&1 >>$seq.full | tee -a $seq.full
|
||||
repquota -$type $SCRATCH_MNT | grep -v "^root" >>$seq.full 2>&1
|
||||
# Now try to overcome block hardlimit
|
||||
echo "Write 1000k..."
|
||||
su $qa_user -c "$XFS_IO_PROG -F -c 'pwrite 0 1000k' -c fsync \
|
||||
$SCRATCH_MNT/file2" 2>&1 >>$seq.full | tee -a $seq.full
|
||||
repquota -$type $SCRATCH_MNT | grep -v "^root" >>$seq.full 2>&1
|
||||
# Now sleep for grace time and check that softlimit got enforced
|
||||
sleep $((grace+1))
|
||||
echo "Write 4096..."
|
||||
su $qa_user -c "$XFS_IO_PROG -F -c 'truncate 0' -c 'pwrite 0 4096' \
|
||||
$SCRATCH_MNT/file2" 2>&1 >>$seq.full | tee -a $seq.full
|
||||
repquota -$type $SCRATCH_MNT | grep -v "^root" >>$seq.full 2>&1
|
||||
# And now the softlimit test for inodes
|
||||
# First reset space limits so that we don't have problems with
|
||||
# space reservations on XFS
|
||||
setquota -$type $qa_user 0 0 3 5 $SCRATCH_MNT
|
||||
echo "Touch 3+4"
|
||||
su $qa_user -c "touch $SCRATCH_MNT/file3 $SCRATCH_MNT/file4" \
|
||||
2>&1 >>$seq.full | filter_scratch | tee -a $seq.full
|
||||
repquota -$type $SCRATCH_MNT | grep -v "^root" >>$seq.full 2>&1
|
||||
# Try to exceed inode hardlimit
|
||||
echo "Touch 5+6"
|
||||
su $qa_user -c "touch $SCRATCH_MNT/file5 $SCRATCH_MNT/file6" \
|
||||
2>&1 >>$seq.full | filter_scratch | tee -a $seq.full
|
||||
repquota -$type $SCRATCH_MNT | grep -v "^root" >>$seq.full 2>&1
|
||||
# Wait and check grace time enforcement
|
||||
rm -f $SCRATCH_MNT/file5 >>$seq.full 2>&1
|
||||
sleep $((grace+1))
|
||||
echo "Touch 5"
|
||||
su $qa_user -c "touch $SCRATCH_MNT/file5" 2>&1 >>$seq.full |
|
||||
filter_scratch | tee -a $seq.full
|
||||
repquota -$type $SCRATCH_MNT | grep -v "^root" >>$seq.full 2>&1
|
||||
echo "--- completed IO ($type)" >>$seq.full
|
||||
}
|
||||
|
||||
cleanup_files()
|
||||
{
|
||||
rm -f $SCRATCH_MNT/file{1,2,3,4,5,6}
|
||||
}
|
||||
|
||||
# real QA test starts here
|
||||
rm -f $seq.full
|
||||
|
||||
grace=2
|
||||
|
||||
_scratch_mkfs >> $seq.full 2>&1
|
||||
_scratch_mount "-o usrquota,grpquota"
|
||||
quotacheck -u -g $SCRATCH_MNT 2>/dev/null
|
||||
quotaon $SCRATCH_MNT 2>/dev/null
|
||||
setquota -u $qa_user 1000 2000 3 5 $SCRATCH_MNT
|
||||
setquota -u -t $grace $grace $SCRATCH_MNT
|
||||
setquota -g $qa_user 1000 2000 3 5 $SCRATCH_MNT
|
||||
setquota -g -t $grace $grace $SCRATCH_MNT
|
||||
umount $SCRATCH_DEV
|
||||
|
||||
echo; echo "### test user limit enforcement"
|
||||
_scratch_mount "-o usrquota"
|
||||
quotaon $SCRATCH_MNT 2>/dev/null
|
||||
type=u
|
||||
test_files
|
||||
test_enforcement
|
||||
cleanup_files
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
|
||||
echo; echo "### test group limit enforcement"
|
||||
_scratch_mount "-o grpquota"
|
||||
quotaon $SCRATCH_MNT 2>/dev/null
|
||||
type=g
|
||||
test_files
|
||||
test_enforcement
|
||||
cleanup_files
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,33 @@
|
||||
QA output created by 230
|
||||
|
||||
### test user limit enforcement
|
||||
|
||||
### create files, setting up ownership (type=u)
|
||||
### some buffered IO (type=u)
|
||||
Write 900k...
|
||||
Rewrite 1001k...
|
||||
Write 1000k...
|
||||
pwrite64: Disk quota exceeded
|
||||
Write 4096...
|
||||
pwrite64: Disk quota exceeded
|
||||
Touch 3+4
|
||||
Touch 5+6
|
||||
touch: cannot touch `[SCR_MNT]/file6': Disk quota exceeded
|
||||
Touch 5
|
||||
touch: cannot touch `[SCR_MNT]/file5': Disk quota exceeded
|
||||
|
||||
### test group limit enforcement
|
||||
|
||||
### create files, setting up ownership (type=g)
|
||||
### some buffered IO (type=g)
|
||||
Write 900k...
|
||||
Rewrite 1001k...
|
||||
Write 1000k...
|
||||
pwrite64: Disk quota exceeded
|
||||
Write 4096...
|
||||
pwrite64: Disk quota exceeded
|
||||
Touch 3+4
|
||||
Touch 5+6
|
||||
touch: cannot touch `[SCR_MNT]/file6': Disk quota exceeded
|
||||
Touch 5
|
||||
touch: cannot touch `[SCR_MNT]/file5': Disk quota exceeded
|
||||
@@ -0,0 +1,141 @@
|
||||
#! /bin/bash
|
||||
# FSQA Test No. 231
|
||||
#
|
||||
# Run fsx with quotas enabled and verify accounted quotas in the end
|
||||
#
|
||||
# Derived from test 127
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2006 Silicon Graphics, Inc. All Rights Reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it would be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
#
|
||||
# creator
|
||||
owner=jack@suse.cz
|
||||
|
||||
seq=`basename $0`
|
||||
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
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
. ./common.quota
|
||||
|
||||
FSX_FILE_SIZE=64000000
|
||||
FSX_ARGS="-q -l $FSX_FILE_SIZE -o 65536 -N 20000"
|
||||
|
||||
filter_scratch()
|
||||
{
|
||||
perl -ne "
|
||||
s,$SCRATCH_MNT,[SCR_MNT],;
|
||||
s,$SCRATCH_DEV,[SCR_DEV],;
|
||||
print;"
|
||||
}
|
||||
|
||||
check_usage()
|
||||
{
|
||||
quotaon -f -u -g $SCRATCH_MNT 2>/dev/null
|
||||
repquota -u -g $SCRATCH_MNT | grep -v "^root" | filter_scratch \
|
||||
>$tmp.orig
|
||||
quotacheck -u -g $SCRATCH_MNT 2>/dev/null
|
||||
repquota -u -g $SCRATCH_MNT | grep -v "^root" | filter_scratch \
|
||||
>$tmp.checked
|
||||
quotaon -u -g $SCRATCH_MNT 2>/dev/null
|
||||
diff $tmp.orig $tmp.checked
|
||||
}
|
||||
|
||||
_fsx()
|
||||
{
|
||||
tasks=$1
|
||||
echo "=== FSX Standard Mode, Memory Mapping, $tasks Tasks ==="
|
||||
for (( i = 1; i <= $tasks; i++ )); do
|
||||
SEED=$RANDOM
|
||||
echo "ltp/fsx $FSX_ARGS -S $SEED $SCRATCH_MNT/fsx_file$i" >>$seq.full
|
||||
su $qa_user -c "ltp/fsx $FSX_ARGS -S $SEED \
|
||||
$SCRATCH_MNT/fsx_file$i" >$tmp.output$i 2>&1 &
|
||||
done
|
||||
|
||||
for (( i = 1; i <= $tasks; i++ )); do
|
||||
if ! wait %$i; then
|
||||
cat $tmp.output$i | tee -a $seq.full
|
||||
wait
|
||||
return 1
|
||||
fi
|
||||
$XFS_IO_PROG -F -c 'fsync' $SCRATCH_MNT/fsx_file$i
|
||||
cat $tmp.output$i | tee -a $seq.full
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
# real QA test starts here
|
||||
_supported_fs generic
|
||||
_supported_os Linux
|
||||
_require_scratch
|
||||
_require_quota
|
||||
_require_user
|
||||
_need_to_be_root
|
||||
|
||||
_scratch_mkfs >> $seq.full 2>&1
|
||||
_scratch_mount "-o usrquota,grpquota"
|
||||
chmod 777 $SCRATCH_MNT
|
||||
quotacheck -u -g $SCRATCH_MNT 2>/dev/null
|
||||
quotaon -u -g $SCRATCH_MNT 2>/dev/null
|
||||
|
||||
if ! _fsx 1; then
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
status=1
|
||||
exit
|
||||
fi
|
||||
|
||||
if ! check_usage; then
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
status=1
|
||||
exit
|
||||
fi
|
||||
|
||||
if ! _fsx 4; then
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
status=1
|
||||
exit
|
||||
fi
|
||||
|
||||
if ! check_usage; then
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
status=1
|
||||
exit
|
||||
fi
|
||||
|
||||
#flush cache after write
|
||||
FSX_ARGS="-f $FSX_ARGS"
|
||||
if ! _fsx 1; then
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
status=1
|
||||
exit
|
||||
fi
|
||||
|
||||
if ! check_usage; then
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
status=1
|
||||
exit
|
||||
fi
|
||||
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,10 @@
|
||||
QA output created by 231
|
||||
=== FSX Standard Mode, Memory Mapping, 1 Tasks ===
|
||||
All operations completed A-OK!
|
||||
=== FSX Standard Mode, Memory Mapping, 4 Tasks ===
|
||||
All operations completed A-OK!
|
||||
All operations completed A-OK!
|
||||
All operations completed A-OK!
|
||||
All operations completed A-OK!
|
||||
=== FSX Standard Mode, Memory Mapping, 1 Tasks ===
|
||||
All operations completed A-OK!
|
||||
@@ -0,0 +1,115 @@
|
||||
#! /bin/bash
|
||||
# FSQA Test No. 232
|
||||
#
|
||||
# Run fsstress with quotas enabled and verify accounted quotas in the end
|
||||
#
|
||||
# Derived from test 231
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2006 Silicon Graphics, Inc. All Rights Reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it would be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
#
|
||||
# creator
|
||||
owner=jack@suse.cz
|
||||
|
||||
seq=`basename $0`
|
||||
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
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
. ./common.quota
|
||||
|
||||
filter_scratch()
|
||||
{
|
||||
perl -ne "
|
||||
s,$SCRATCH_MNT,[SCR_MNT],;
|
||||
s,$SCRATCH_DEV,[SCR_DEV],;
|
||||
print;"
|
||||
}
|
||||
|
||||
check_usage()
|
||||
{
|
||||
quotaon -f -u -g $SCRATCH_MNT 2>/dev/null
|
||||
repquota -u -g -n $SCRATCH_MNT | grep -v "^#0" | filter_scratch |
|
||||
sort >$tmp.orig
|
||||
quotacheck -u -g $SCRATCH_MNT 2>/dev/null
|
||||
repquota -u -g -n $SCRATCH_MNT | grep -v "^#0" | filter_scratch |
|
||||
sort >$tmp.checked
|
||||
quotaon -u -g $SCRATCH_MNT 2>/dev/null
|
||||
diff $tmp.orig $tmp.checked
|
||||
}
|
||||
|
||||
_filter_num()
|
||||
{
|
||||
tee -a $here/$seq.full |\
|
||||
sed -e 's/[0-9][0-9]* inodes/I inodes/g' \
|
||||
-e 's/[0-9][0-9]* paths/P paths/g' \
|
||||
-e 's/seed = [0-9][0-9]*/seed = S/'
|
||||
}
|
||||
|
||||
_fsstress()
|
||||
{
|
||||
echo ""
|
||||
echo "Testing fsstress"
|
||||
echo ""
|
||||
|
||||
out=$SCRATCH_MNT/fsstress.$$
|
||||
count=2000
|
||||
args="-n $count -d $out -p 7"
|
||||
|
||||
echo "fsstress $args" | tee -a $here/$seq.full | sed -e "s#$out#outdir#"
|
||||
if ! $FSSTRESS_PROG $args | tee -a $here/$seq.full | _filter_num
|
||||
then
|
||||
echo " fsstress $args returned $?"
|
||||
cat $tmp.out | tee -a $here/$seq.full
|
||||
status=1
|
||||
fi
|
||||
}
|
||||
|
||||
# real QA test starts here
|
||||
_supported_fs generic
|
||||
_supported_os Linux
|
||||
_require_scratch
|
||||
_require_quota
|
||||
_need_to_be_root
|
||||
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
_scratch_mkfs >> $seq.full 2>&1
|
||||
_scratch_mount "-o usrquota,grpquota"
|
||||
chmod 777 $SCRATCH_MNT
|
||||
quotacheck -u -g $SCRATCH_MNT 2>/dev/null
|
||||
quotaon -u -g $SCRATCH_MNT 2>/dev/null
|
||||
|
||||
if ! _fsstress; then
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
exit
|
||||
fi
|
||||
|
||||
if ! check_usage; then
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
status=1
|
||||
exit
|
||||
fi
|
||||
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,6 @@
|
||||
QA output created by 232
|
||||
|
||||
Testing fsstress
|
||||
|
||||
fsstress -n 2000 -d outdir -p 7
|
||||
seed = S
|
||||
@@ -0,0 +1,124 @@
|
||||
#! /bin/bash
|
||||
# FSQA Test No. 233
|
||||
#
|
||||
# Run fsstress with quotas enabled and limits set low and verify accounted
|
||||
# quotas in the end
|
||||
#
|
||||
# Derived from test 231
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2006 Silicon Graphics, Inc. All Rights Reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it would be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
#
|
||||
# creator
|
||||
owner=jack@suse.cz
|
||||
|
||||
seq=`basename $0`
|
||||
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
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
. ./common.quota
|
||||
|
||||
FSX_FILE_SIZE=64000000
|
||||
FSX_ARGS="-q -l $FSX_FILE_SIZE -o 65536 -S 191110531 -N 100000"
|
||||
|
||||
filter_scratch()
|
||||
{
|
||||
perl -ne "
|
||||
s,$SCRATCH_MNT,[SCR_MNT],;
|
||||
s,$SCRATCH_DEV,[SCR_DEV],;
|
||||
print;"
|
||||
}
|
||||
|
||||
check_usage()
|
||||
{
|
||||
quotaon -f -u -g $SCRATCH_MNT 2>/dev/null
|
||||
repquota -u -g -n $SCRATCH_MNT | grep -v "^#0" | filter_scratch |
|
||||
sort >$tmp.orig
|
||||
quotacheck -u -g $SCRATCH_MNT 2>/dev/null
|
||||
repquota -u -g -n $SCRATCH_MNT | grep -v "^#0" | filter_scratch |
|
||||
sort >$tmp.checked
|
||||
quotaon -u -g $SCRATCH_MNT 2>/dev/null
|
||||
diff $tmp.orig $tmp.checked
|
||||
}
|
||||
|
||||
_filter_num()
|
||||
{
|
||||
tee -a $here/$seq.full |\
|
||||
sed -e 's/[0-9][0-9]* inodes/I inodes/g' \
|
||||
-e 's/[0-9][0-9]* paths/P paths/g' \
|
||||
-e 's/seed = [0-9][0-9]*/seed = S/'
|
||||
}
|
||||
|
||||
_fsstress()
|
||||
{
|
||||
echo ""
|
||||
echo "Testing fsstress"
|
||||
echo ""
|
||||
|
||||
out=$SCRATCH_MNT/fsstress.$$
|
||||
count=5000
|
||||
args="-z \
|
||||
-f rmdir=20 -f link=10 -f creat=10 -f mkdir=10 -f unlink=20 -f symlink=10 \
|
||||
-f rename=10 -f fsync=2 -f write=15 -f dwrite=15 \
|
||||
-n $count -d $out -p 7"
|
||||
|
||||
echo "fsstress $args" | tee -a $here/$seq.full | sed -e "s#$out#outdir#"
|
||||
if ! su $qa_user -c "$FSSTRESS_PROG $args" | tee -a $here/$seq.full | _filter_num
|
||||
then
|
||||
echo " fsstress $args returned $?"
|
||||
cat $tmp.out | tee -a $here/$seq.full
|
||||
status=1
|
||||
fi
|
||||
}
|
||||
|
||||
# real QA test starts here
|
||||
_supported_fs generic
|
||||
_supported_os Linux
|
||||
_require_scratch
|
||||
_require_quota
|
||||
_require_user
|
||||
_need_to_be_root
|
||||
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
_scratch_mkfs >> $seq.full 2>&1
|
||||
_scratch_mount "-o usrquota,grpquota"
|
||||
chmod 777 $SCRATCH_MNT
|
||||
quotacheck -u -g $SCRATCH_MNT 2>/dev/null
|
||||
quotaon -u -g $SCRATCH_MNT 2>/dev/null
|
||||
setquota -u $qa_user 32000 32000 1000 1000 $SCRATCH_MNT 2>/dev/null
|
||||
|
||||
if ! _fsstress; then
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
exit
|
||||
fi
|
||||
|
||||
if ! check_usage; then
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
status=1
|
||||
exit
|
||||
fi
|
||||
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,6 @@
|
||||
QA output created by 233
|
||||
|
||||
Testing fsstress
|
||||
|
||||
fsstress -z -f rmdir=20 -f link=10 -f creat=10 -f mkdir=10 -f unlink=20 -f symlink=10 -f rename=10 -f fsync=2 -f write=15 -f dwrite=15 -n 5000 -d outdir -p 7
|
||||
seed = S
|
||||
@@ -0,0 +1,108 @@
|
||||
#! /bin/bash
|
||||
# FS QA Test No. 234
|
||||
#
|
||||
# Stress setquota and setinfo handling.
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2010 Jan Kara. All Rights Reserved.
|
||||
#
|
||||
# Based on test 219,
|
||||
# Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it would be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
#
|
||||
# creator
|
||||
owner=jack@suse.cz
|
||||
|
||||
seq=`basename $0`
|
||||
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
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
. ./common.quota
|
||||
|
||||
test_setting()
|
||||
{
|
||||
echo; echo "### test limits and info setting"
|
||||
count=2000
|
||||
procs=5
|
||||
idmod=200000
|
||||
seed=$RANDOM
|
||||
RANDOM=$seed
|
||||
echo "Starting test with procs=$procs, idmod=$idmod, and seed=$seed" >>$seq.full
|
||||
|
||||
for (( i = 0; i < $procs; i++ )); do
|
||||
( SETUCOUNT=1; SETGCOUNT=1; SETUIDS[0]=0; SETGIDS[0]=0
|
||||
for (( j = 0; j < $count; j++ )); do
|
||||
OP=$(($RANDOM%22))
|
||||
UG=$(($OP%2))
|
||||
OP=$(($OP/2))
|
||||
if [ $UG -eq 1 ]; then
|
||||
type='u'
|
||||
else
|
||||
type='g'
|
||||
fi
|
||||
if [ $OP -eq 10 ]; then
|
||||
setquota -t -$type $j $j $SCRATCH_MNT
|
||||
elif [ $OP -lt 5 ]; then
|
||||
ID=$((($RANDOM*32768+$RANDOM)%$idmod))
|
||||
if [ $UG -eq 1 ]; then
|
||||
SETUIDS[$SETUCOUNT]=$ID
|
||||
SETUCOUNT=$(($SETUCOUNT+1))
|
||||
else
|
||||
SETGIDS[$SETGCOUNT]=$ID
|
||||
SETGCOUNT=$(($SETGCOUNT+1))
|
||||
fi
|
||||
setquota -$type $ID $j $j $j $j $SCRATCH_MNT
|
||||
else
|
||||
if [ $UG -eq 1 ]; then
|
||||
ID=${SETUIDS[$(($RANDOM%$SETUCOUNT))]}
|
||||
else
|
||||
ID=${SETGIDS[$(($RANDOM%$SETGCOUNT))]}
|
||||
fi
|
||||
setquota -$type $ID 0 0 0 0 $SCRATCH_MNT
|
||||
fi
|
||||
done )&
|
||||
done
|
||||
wait
|
||||
echo "### done with testing"
|
||||
}
|
||||
|
||||
# real QA test starts here
|
||||
_supported_fs generic
|
||||
_supported_os Linux #IRIX
|
||||
_require_scratch
|
||||
_require_quota
|
||||
_need_to_be_root
|
||||
|
||||
# real QA test starts here
|
||||
rm -f $seq.full
|
||||
|
||||
_scratch_mkfs >> $seq.full 2>&1
|
||||
_scratch_mount "-o usrquota,grpquota"
|
||||
quotacheck -u -g $SCRATCH_MNT 2>/dev/null
|
||||
quotaon -u -g $SCRATCH_MNT 2>/dev/null
|
||||
test_setting
|
||||
umount $SCRATCH_DEV
|
||||
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,4 @@
|
||||
QA output created by 234
|
||||
|
||||
### test limits and info setting
|
||||
### done with testing
|
||||
@@ -0,0 +1,83 @@
|
||||
#! /bin/bash
|
||||
# FS QA Test No. 235
|
||||
#
|
||||
# Test whether quota gets properly reenabled after remount read-write
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2010 Jan Kara. All Rights Reserved.
|
||||
#
|
||||
# Based on test 219,
|
||||
# Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it would be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
#
|
||||
# creator
|
||||
owner=jack@suse.cz
|
||||
|
||||
seq=`basename $0`
|
||||
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
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
. ./common.quota
|
||||
|
||||
filter_scratch()
|
||||
{
|
||||
perl -ne "
|
||||
s,$SCRATCH_MNT,[SCR_MNT],;
|
||||
s,$SCRATCH_DEV,[SCR_DEV],;
|
||||
print;"
|
||||
}
|
||||
|
||||
# real QA test starts here
|
||||
_supported_fs generic
|
||||
_supported_os Linux #IRIX
|
||||
_require_scratch
|
||||
_require_quota
|
||||
_require_user
|
||||
_need_to_be_root
|
||||
|
||||
# real QA test starts here
|
||||
rm -f $seq.full
|
||||
|
||||
_scratch_mkfs >> $seq.full 2>&1
|
||||
_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
|
||||
|
||||
repquota -u -g $SCRATCH_MNT | grep -v "^root" | filter_scratch
|
||||
|
||||
mount -o remount,ro $SCRATCH_DEV 2>&1 | tee -a $seq.full | filter_scratch
|
||||
touch $SCRATCH_MNT/failed 2>&1 | tee -a $seq.full | filter_scratch
|
||||
mount -o remount,rw $SCRATCH_DEV 2>&1 | tee -a $seq.full | filter_scratch
|
||||
|
||||
$XFS_IO_PROG -F -c 'pwrite 0 16k' -c 'fsync' \
|
||||
$SCRATCH_MNT/testfile >>$seq.full 2>&1
|
||||
repquota -u -g $SCRATCH_MNT | grep -v "^root" | filter_scratch
|
||||
|
||||
umount $SCRATCH_DEV 2>/dev/null
|
||||
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,34 @@
|
||||
QA output created by 235
|
||||
*** Report for user quotas on device [SCR_DEV]
|
||||
Block grace time: 7days; Inode grace time: 7days
|
||||
Block limits File limits
|
||||
User used soft hard grace used soft hard grace
|
||||
----------------------------------------------------------------------
|
||||
fsgqa -- 0 0 0 1 0 0
|
||||
|
||||
|
||||
*** Report for group quotas on device [SCR_DEV]
|
||||
Block grace time: 7days; Inode grace time: 7days
|
||||
Block limits File limits
|
||||
Group used soft hard grace used soft hard grace
|
||||
----------------------------------------------------------------------
|
||||
fsgqa -- 0 0 0 1 0 0
|
||||
|
||||
|
||||
touch: cannot touch `[SCR_MNT]/failed': Read-only file system
|
||||
*** Report for user quotas on device [SCR_DEV]
|
||||
Block grace time: 7days; Inode grace time: 7days
|
||||
Block limits File limits
|
||||
User used soft hard grace used soft hard grace
|
||||
----------------------------------------------------------------------
|
||||
fsgqa -- 16 0 0 1 0 0
|
||||
|
||||
|
||||
*** Report for group quotas on device [SCR_DEV]
|
||||
Block grace time: 7days; Inode grace time: 7days
|
||||
Block limits File limits
|
||||
Group used soft hard grace used soft hard grace
|
||||
----------------------------------------------------------------------
|
||||
fsgqa -- 16 0 0 1 0 0
|
||||
|
||||
|
||||
+5
-4
@@ -27,10 +27,11 @@
|
||||
_require_quota()
|
||||
{
|
||||
[ -x /usr/bin/quota ] || _notrun "Quota user tools not installed"
|
||||
_scratch_mount "-o usrquota,grpquota"
|
||||
ret=$?
|
||||
umount $SCRATCH_MNT
|
||||
[ $ret -ne 0 ] && _notrun "Installed kernel does not support quota"
|
||||
if [ $FSTYP = "xfs" ]; then
|
||||
[ -f /proc/fs/xfs/xqmstat ] || _notrun "Installed kernel does not support XFS quota"
|
||||
elif [ $FSTYP != "gfs2" ]; then
|
||||
[ -d /proc/sys/fs/quota ] || _notrun "Installed kernel does not support quota"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
|
||||
@@ -803,8 +803,9 @@ _require_user()
|
||||
#
|
||||
_require_xfs_io_falloc()
|
||||
{
|
||||
testio=`$XFS_IO_PROG -F -f -c "falloc 0 1m" $TEST_DIR/$tmp.io 2>&1`
|
||||
rm -f $TEST_DIR/$tmp.io 2>&1 > /dev/null
|
||||
testfile=$TEST_DIR/$$.falloc
|
||||
testio=`$XFS_IO_PROG -F -f -c "falloc 0 1m" $testfile 2>&1`
|
||||
rm -f $testfile 2>&1 > /dev/null
|
||||
echo $testio | grep -q "not found" && \
|
||||
_notrun "xfs_io fallocate support is missing"
|
||||
echo $testio | grep -q "Operation not supported" && \
|
||||
|
||||
Reference in New Issue
Block a user