2010-01-20 10:27:08 +11:00
|
|
|
#! /bin/bash
|
2016-09-23 09:51:26 +08:00
|
|
|
# FS QA Test No. 385
|
2008-12-31 12:53:33 +01:00
|
|
|
#
|
|
|
|
|
# Make sure renames accross project boundaries are properly rejected
|
|
|
|
|
# and that we don't use the wrong lock flags internally.
|
|
|
|
|
#
|
|
|
|
|
# Based on a report and testcase from Arkadiusz Miskiewicz <arekm@maven.pl>
|
|
|
|
|
#
|
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
|
# Copyright (c) 2008 Christoph Hellwig.
|
2009-05-27 10:10:42 +02:00
|
|
|
#
|
|
|
|
|
# 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
|
2008-12-31 12:53:33 +01:00
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
seq=`basename $0`
|
2013-03-15 12:28:02 +00:00
|
|
|
seqres=$RESULT_DIR/$seq
|
2008-12-31 12:53:33 +01:00
|
|
|
echo "QA output created by $seq"
|
|
|
|
|
|
|
|
|
|
here=`pwd`
|
|
|
|
|
tmp=/tmp/$$
|
|
|
|
|
status=1 # failure is the default!
|
|
|
|
|
|
|
|
|
|
_cleanup()
|
|
|
|
|
{
|
|
|
|
|
cd /
|
2015-12-21 18:07:43 +11:00
|
|
|
_scratch_unmount
|
2008-12-31 12:53:33 +01:00
|
|
|
rm -f $tmp.*
|
|
|
|
|
}
|
|
|
|
|
trap "_cleanup; 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
|
2008-12-31 12:53:33 +01:00
|
|
|
|
|
|
|
|
# real QA test starts here
|
2016-09-22 17:51:03 -05:00
|
|
|
_supported_fs generic
|
2008-12-31 12:53:33 +01:00
|
|
|
_supported_os Linux
|
|
|
|
|
|
|
|
|
|
_require_scratch
|
2016-09-22 17:51:03 -05:00
|
|
|
_require_quota
|
|
|
|
|
_require_xfs_quota_foreign
|
2008-12-31 12:53:33 +01:00
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Setup temporary replacements for /etc/projects and /etc/projid
|
|
|
|
|
#
|
|
|
|
|
cat >$tmp.projects <<EOF
|
|
|
|
|
42:$SCRATCH_MNT/t
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
cat >$tmp.projid <<EOF
|
|
|
|
|
answer:42
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# And make sure we always use our replacements
|
|
|
|
|
#
|
2016-09-22 17:51:03 -05:00
|
|
|
quota_cmd="$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid"
|
2008-12-31 12:53:33 +01:00
|
|
|
|
2016-09-22 17:51:03 -05:00
|
|
|
_scratch_mkfs >/dev/null 2>&1
|
|
|
|
|
_scratch_enable_pquota
|
|
|
|
|
_qmount_option "prjquota"
|
2008-12-31 12:53:33 +01:00
|
|
|
_qmount
|
2016-12-16 12:14:14 +08:00
|
|
|
_require_prjquota $SCRATCH_DEV
|
2008-12-31 12:53:33 +01:00
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Create the project root
|
|
|
|
|
#
|
|
|
|
|
mkdir $SCRATCH_MNT/t
|
|
|
|
|
|
|
|
|
|
$quota_cmd -x -c 'project -s answer' $SCRATCH_MNT >/dev/null 2>&1
|
|
|
|
|
$quota_cmd -x -c 'limit -p bhard=100m answer' $SCRATCH_MNT
|
|
|
|
|
|
|
|
|
|
touch $SCRATCH_MNT/test
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Try renaming a file into the project. This should fail.
|
|
|
|
|
#
|
|
|
|
|
# We repeat this a couple thousand times as a single rename couldn't
|
|
|
|
|
# always trigger the wrong unlock flags bug we had in older kernels.
|
|
|
|
|
#
|
|
|
|
|
for i in `seq 1 2000`; do
|
|
|
|
|
src/rename test t/test
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# success, all done
|
|
|
|
|
echo "*** done"
|
2013-03-15 12:28:02 +00:00
|
|
|
rm -f $seqres.full
|
2008-12-31 12:53:33 +01:00
|
|
|
status=0
|