set -e
ONLY=${ONLY:-"$*"}
-# bug number for skipped test:
-ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-""}
+# bug number for skipped test: 2399 (temporarily until new kernels arrive)
+ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"48"}
# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
[ "$ALWAYS_EXCEPT$EXCEPT" ] && echo "Skipping tests: $ALWAYS_EXCEPT $EXCEPT"
run_test 25a "create file in symlinked directory ==============="
test_25b() {
- if [ ! -d $DIR/d25 ]; then
- run_one 25a
- fi
+ [ ! -d $DIR/d25 ] && test_25a
$CHECKSTAT -t file $DIR/s25/foo || error
}
run_test 25b "lookup file in symlinked directory ==============="
run_test 26d "create multiple component recursive symlink ======"
test_26e() {
- if [ ! -h $DIR/d26-3 ]; then
- run_one 26d
- fi
+ [ ! -h $DIR/d26-3 ] && test_26d
rm $DIR/d26-3
}
run_test 26e "unlink multiple component recursive symlink ======"
test_27a() {
echo '== stripe sanity =============================================='
mkdir $DIR/d27
- $LSTRIPE $DIR/d27/f0 8192 0 1 || error
+ $LSTRIPE $DIR/d27/f0 65536 0 1 || error
$CHECKSTAT -t file $DIR/d27/f0 || error
pass
log "== test_27b: write to one stripe file ========================="
if [ ! -d $DIR/d27 ]; then
mkdir $DIR/d27
fi
- $LSTRIPE $DIR/d27/f01 8192 0 2 || error
+ $LSTRIPE $DIR/d27/f01 65536 0 2 || error
[ `$LFIND $DIR/d27/f01 | grep -A 10 obdidx | wc -l` -eq 4 ] ||
error "two-stripe file doesn't have two stripes"
pass
if [ ! -d $DIR/d27 ]; then
mkdir $DIR/d27
fi
- $LSTRIPE $DIR/d27/f12 8192 0 2 || error
- $LSTRIPE $DIR/d27/f12 8192 0 2 && error
+ $LSTRIPE $DIR/d27/f12 65536 0 2 || error
+ $LSTRIPE $DIR/d27/f12 65536 0 2 && error
$CHECKSTAT -t file $DIR/d27/f12 || error
}
run_test 27e "lstripe existing file (should return error) ======"
if [ ! -d $DIR/d27 ]; then
mkdir $DIR/d27
fi
- $LSTRIPE $DIR/d27/f27j 8192 $STRIPECOUNT 1 && error || true
+ $LSTRIPE $DIR/d27/f27j 65536 $STRIPECOUNT 1 && error || true
}
run_test 27j "lstripe with bad stripe offset (should return error)"
+test_27k() { # bug 2844
+ FILE=$DIR/d27/f27k
+ LL_MAX_BLKSIZE=$((4 * 1024 * 1024))
+ [ ! -d $DIR/d27 ] && mkdir -p $DIR/d27
+ $LSTRIPE $FILE 67108864 -1 0 || error "lstripe failed"
+ BLKSIZE=`stat $FILE | awk '/IO Block:/ { print $7 }'`
+ [ $BLKSIZE -le $LL_MAX_BLKSIZE ] || error "$BLKSIZE > $LL_MAX_BLKSIZE"
+ dd if=/dev/zero of=$FILE bs=4k count=1
+ BLKSIZE=`stat $FILE | awk '/IO Block:/ { print $7 }'`
+ [ $BLKSIZE -le $LL_MAX_BLKSIZE ] || error "$BLKSIZE > $LL_MAX_BLKSIZE"
+}
+run_test 27k "limit i_blksize for broken user apps ============="
+
test_28() {
mkdir $DIR/d28
$CREATETEST $DIR/d28/ct || error
TEST_34_SIZE=${TEST_34_SIZE:-2000000000000}
test_34a() {
- rm -f $DIR/test_34_file
- $MCREATE $DIR/test_34_file || error
- $LFIND $DIR/test_34_file 2>&1 | grep -q "no stripe info" || error
- $TRUNCATE $DIR/test_34_file $TEST_34_SIZE || error
- $LFIND $DIR/test_34_file 2>&1 | grep -q "no stripe info" || error
- $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
+ rm -f $DIR/f34
+ $MCREATE $DIR/f34 || error
+ $LFIND $DIR/f34 2>&1 | grep -q "no stripe info" || error
+ $TRUNCATE $DIR/f34 $TEST_34_SIZE || error
+ $LFIND $DIR/f34 2>&1 | grep -q "no stripe info" || error
+ $CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error
}
run_test 34a "truncate file that has not been opened ==========="
test_34b() {
- [ ! -f $DIR/test_34_file ] && run_one 34a
- $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
- $OPENFILE -f O_RDONLY $DIR/test_34_file
- $LFIND $DIR/test_34_file 2>&1 | grep -q "no stripe info" || error
- $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
+ [ ! -f $DIR/f34 ] && test_34a
+ $CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error
+ $OPENFILE -f O_RDONLY $DIR/f34
+ $LFIND $DIR/f34 2>&1 | grep -q "no stripe info" || error
+ $CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error
}
run_test 34b "O_RDONLY opening file doesn't create objects ====="
test_34c() {
- [ ! -f $DIR/test_34_file ] && run_one 34a
- $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
- $OPENFILE -f O_RDWR $DIR/test_34_file
- $LFIND $DIR/test_34_file 2>&1 | grep -q "no stripe info" && error
- $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
+ [ ! -f $DIR/f34 ] && test_34a
+ $CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error
+ $OPENFILE -f O_RDWR $DIR/f34
+ $LFIND $DIR/f34 2>&1 | grep -q "no stripe info" && error
+ $CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error
}
run_test 34c "O_RDWR opening file-with-size works =============="
test_34d() {
- dd if=/dev/zero of=$DIR/test_34_file conv=notrunc bs=4k count=1 || error
- $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
- rm $DIR/test_34_file
+ dd if=/dev/zero of=$DIR/f34 conv=notrunc bs=4k count=1 || error
+ $CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error
+ rm $DIR/f34
}
run_test 34d "write to sparse file ============================="
test_34e() {
- rm -f $DIR/test_34_file
- $MCREATE $DIR/test_34_file || error
- $TRUNCATE $DIR/test_34_file 1000 || error
- $CHECKSTAT -s 1000 $DIR/test_34_file || error
- $OPENFILE -f O_RDWR $DIR/test_34_file
- $CHECKSTAT -s 1000 $DIR/test_34_file || error
+ rm -f $DIR/f34e
+ $MCREATE $DIR/f34e || error
+ $TRUNCATE $DIR/f34e 1000 || error
+ $CHECKSTAT -s 1000 $DIR/f34e || error
+ $OPENFILE -f O_RDWR $DIR/f34e
+ $CHECKSTAT -s 1000 $DIR/f34e || error
}
run_test 34e "create objects, some with size and some without =="
test_35a() {
- cp /bin/sh $DIR/test_35a_file
- chmod 444 $DIR/test_35a_file
- chown $RUNAS_ID $DIR/test_35a_file
- $RUNAS $DIR/test_35a_file && error || true
- rm $DIR/test_35a_file
+ cp /bin/sh $DIR/f35a
+ chmod 444 $DIR/f35a
+ chown $RUNAS_ID $DIR/f35a
+ $RUNAS $DIR/f35a && error || true
+ rm $DIR/f35a
}
run_test 35a "exec file with mode 444 (should return and not leak) ====="
-
test_36a() {
- rm -f $DIR/test_36_file
- utime $DIR/test_36_file || error
+ rm -f $DIR/f36
+ utime $DIR/f36 || error
}
run_test 36a "MDS utime check (mknod, utime) ==================="
test_36b() {
- echo "" > $DIR/test_36_file
- utime $DIR/test_36_file || error
+ echo "" > $DIR/f36
+ utime $DIR/f36 || error
}
run_test 36b "OST utime check (open, utime) ===================="
test_36c() {
- rm -f $DIR/d36/test_36_file
+ rm -f $DIR/d36/f36
mkdir $DIR/d36
chown $RUNAS_ID $DIR/d36
- $RUNAS utime $DIR/d36/test_36_file || error
+ $RUNAS utime $DIR/d36/f36 || error
}
run_test 36c "non-root MDS utime check (mknod, utime) =========="
test_36d() {
- [ ! -d $DIR/d36 ] && run_one 36c
- echo "" > $DIR/d36/test_36_file
- $RUNAS utime $DIR/d36/test_36_file || error
+ [ ! -d $DIR/d36 ] && test_36c
+ echo "" > $DIR/d36/f36
+ $RUNAS utime $DIR/d36/f36 || error
}
run_test 36d "non-root OST utime check (open, utime) ==========="
test_36e() {
[ $RUNAS_ID -eq $UID ] && return
[ ! -d $DIR/d36 ] && mkdir $DIR/d36
- touch $DIR/d36/test_36_file2
- $RUNAS utime $DIR/d36/test_36_file2 && error || true
+ touch $DIR/d36/f36e
+ $RUNAS utime $DIR/d36/f36e && error "utime worked, want failure" || true
}
run_test 36e "utime on non-owned file (should return error) ===="
trap start_kupdated EXIT
}
+# ensure that all stripes have some grant before we test client-side cache
+for i in `seq -f $DIR/f42-%g 1 $STRIPECOUNT`; do
+ dd if=/dev/zero of=$i bs=4k count=1
+ rm $i
+done
+
# Tests 42* verify that our behaviour is correct WRT caching, file closure,
# file truncation, and file removal.
test_42a() {
cancel_lru_locks OSC
stop_kupdated
- sync # just to be safe
- BEFOREWRITES=`count_ost_writes`
- dd if=/dev/zero of=$DIR/f42a bs=1024 count=100
- AFTERWRITES=`count_ost_writes`
- [ $BEFOREWRITES -eq $AFTERWRITES ] || \
+ sync; sleep 1; sync # just to be safe
+ BEFOREWRITES=`count_ost_writes`
+ grep [0-9] /proc/fs/lustre/osc/OSC*MNT*/cur_grant_bytes
+ dd if=/dev/zero of=$DIR/f42a bs=1024 count=100
+ AFTERWRITES=`count_ost_writes`
+ [ $BEFOREWRITES -eq $AFTERWRITES ] || \
error "$BEFOREWRITES < $AFTERWRITES"
start_kupdated
}
}
run_test 47 "Device nodes check ================================"
-test_48() {
- mkdir $DIR/d48
- cd $DIR/d48
- mv $DIR/d48 $DIR/d48.new || error "move directory failed"
- mkdir $DIR/d48 || error "recreate diectory failed"
- ls || error "can't list after recreate directory"
-}
-run_test 48 "Access renamed current working directory =========="
+test_48a() {
+ mkdir $DIR/d48a
+ cd $DIR/d48a
+ mv $DIR/d48a $DIR/d48.new || error "move directory failed"
+ mkdir $DIR/d48a || error "recreate directory failed"
+ touch foo || error "'touch foo' failed after recreating cwd"
+ mkdir bar || error "'mkdir foo' failed after recreating cwd"
+ ls . || error "'ls .' failed after recreating cwd"
+ ls .. || error "'ls ..' failed after removing cwd"
+ cd . || error "'cd .' failed after recreating cwd"
+ mkdir . && error "'mkdir .' worked after recreating cwd"
+ rmdir . && error "'rmdir .' worked after recreating cwd"
+ ln -s . baz || error "'ln -s .' failed after recreating cwd"
+}
+run_test 48a "Access renamed working dir (should return errors)="
+
+test_48b() {
+ mkdir $DIR/d48b
+ cd $DIR/d48b
+ rmdir $DIR/d48b || error "remove cwd $DIR/d48b failed"
+ touch foo && error "'touch foo' worked after removing cwd"
+ mkdir foo && error "'mkdir foo' worked after removing cwd"
+ ls . && error "'ls .' worked after removing cwd"
+ ls .. || error "'ls ..' failed after removing cwd"
+ cd . && error "'cd .' worked after recreate cwd"
+ mkdir . && error "'mkdir .' worked after removing cwd"
+ rmdir . && error "'rmdir .' worked after removing cwd"
+ ln -s . foo && error "'ln -s .' worked after removing cwd" || true
+}
+run_test 48b "Access removed working dir (should return errors)="
test_50() {
# bug 1485
run_test 99a "cvs init ========================================="
test_99b() {
- [ ! -d $DIR/d99cvsroot ] && run_one 99a
+ [ ! -d $DIR/d99cvsroot ] && test_99a
cd /etc/init.d
$RUNAS cvs -d $DIR/d99cvsroot import -m "nomesg" d99reposname vtag rtag
}
run_test 99b "cvs import ======================================="
test_99c() {
- [ ! -d $DIR/d99cvsroot ] && run_one 99b
+ [ ! -d $DIR/d99cvsroot ] && test_99b
cd $DIR
mkdir -p $DIR/d99reposname
chown $RUNAS_ID $DIR/d99reposname
run_test 99c "cvs checkout ====================================="
test_99d() {
- [ ! -d $DIR/d99cvsroot ] && run_one 99c
+ [ ! -d $DIR/d99cvsroot ] && test_99c
cd $DIR/d99reposname
$RUNAS touch foo99
$RUNAS cvs add -m 'addmsg' foo99
run_test 99d "cvs add =========================================="
test_99e() {
- [ ! -d $DIR/d99cvsroot ] && run_one 99c
+ [ ! -d $DIR/d99cvsroot ] && test_99c
cd $DIR/d99reposname
$RUNAS cvs update
}
run_test 99e "cvs update ======================================="
test_99f() {
- [ ! -d $DIR/d99cvsroot ] && run_one 99d
+ [ ! -d $DIR/d99cvsroot ] && test_99d
cd $DIR/d99reposname
$RUNAS cvs commit -m 'nomsg' foo99
}