#ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"27m 42a 42b 42c 42d 45 68 76"}
# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
-[ "$SLOW" = "no" ] && EXCEPT="$EXCEPT 24o 27m 36f 36g 51b 51c 63 64b 68 71 73 101 115"
+[ "$SLOW" = "no" ] && EXCEPT_SLOW="24o 27m 36f 36g 51b 51c 60c 63 64b 68 71 73 78 101 103 115 120g"
# Tests that fail on uml
CPU=`awk '/model/ {print $4}' /proc/cpuinfo`
[ -f $DIR/d52b/foo ] && chattr -i $DIR/d52b/foo
rm -rf $DIR/[Rdfs][1-9]*
+check_runas_id $RUNAS_ID $RUNAS
+
build_test_filter
if [ "${ONLY}" = "MOUNT" ] ; then
test_22() {
WDIR=$DIR/$tdir
- mkdir $WDIR
chown $RUNAS_ID $WDIR
(cd $WDIR || error "cd $WDIR failed";
$RUNAS tar cf - /etc/hosts /etc/sysconfig/network | \
# recursive symlinks (bug 7022)
test_26f() {
- mkdir $DIR/$tfile || error "mkdir $DIR/$tfile failed"
- cd $DIR/$tfile || error "cd $DIR/$tfile failed"
- mkdir -p $tdir/bar1 || error "mkdir $tdir/bar1 failed"
+ mkdir $DIR/$tdir/$tfile || error "mkdir $DIR/$tdir/$tfile failed"
+ cd $DIR/$tdir/$tfile || error "cd $DIR/$tdir/$tfile failed"
+ mkdir -p lndir/bar1 || error "mkdir lndir/bar1 failed"
mkdir $tfile || error "mkdir $tfile failed"
cd $tfile || error "cd $tfile failed"
ln -s .. dotdot || error "ln dotdot failed"
- ln -s dotdot/$tdir $tdir || error "ln $tdir failed"
- cd ../.. || error "cd ../.. failed"
- output=`ls $tfile/$tfile/$tdir/bar1`
+ ln -s dotdot/lndir lndir || error "ln lndir failed"
+ cd $DIR/$tdir || error "cd $DIR/$tdir failed"
+ output=`ls $tfile/$tfile/lndir/bar1`
[ "$output" = bar1 ] && error "unexpected output"
rm -r $tfile || error "rm $tfile failed"
$CHECKSTAT -a $DIR/$tfile || error "$tfile not gone"
run_test 42d "test complete truncate of file with cached dirty data"
test_43() {
- mkdir $DIR/$tdir
cp -p /bin/ls $DIR/$tdir/$tfile
- exec 9>> $DIR/$tdir/$tfile
+ multiop $DIR/$tdir/$tfile Ow_c &
+ pid=$!
+ # give multiop a chance to open
+ sleep 1
+
$DIR/$tdir/$tfile && error || true
- exec 9<&-
+ kill -USR1 $pid
}
run_test 43 "execution of file opened for write should return -ETXTBSY"
check_kernel_version 46 || return 0
f="$DIR/f54e"
string="aaaaaa"
- mknod $f c 4 0
+ mknod $f c 5 0
echo $string > $f || error
}
run_test 54e "console/tty device works in lustre ======================"
fi
}
+setup_56_special() {
+ LOCAL_NUMFILES=$1
+ LOCAL_NUMDIRS=$2
+ TDIR=$DIR/${tdir}g
+ setup_56 $1 $2
+ if [ ! -e "$TDIR/loop1b" ] ; then
+ for i in `seq 1 $LOCAL_NUMFILES` ; do
+ mknod $TDIR/loop${i}b b 7 $i
+ mknod $TDIR/null${i}c c 1 3
+ ln -s $TDIR/file1 $TDIR/link${i}l
+ done
+ for i in `seq 1 $LOCAL_NUMDIRS` ; do
+ mknod $TDIR/dir$i/loop${i}b b 7 $i
+ mknod $TDIR/dir$i/null${i}c c 1 3
+ ln -s $TDIR/dir$i/file1 $TDIR/dir$i/link${i}l
+ done
+ fi
+}
+
test_56g() {
$LSTRIPE -d $DIR
}
run_test 56i "check 'lfs find -ost UUID' skips directories ======="
+test_56j() {
+ setup_56_special $NUMFILES $NUMDIRS
+
+ EXPECTED=$((NUMDIRS+1))
+ NUMS=`$LFIND -type d $DIR/${tdir}g | wc -l`
+ [ $NUMS -eq $EXPECTED ] || \
+ error "lfs find -type d $DIR/${tdir}g wrong: found $NUMS, expected $EXPECTED"
+}
+run_test 56j "check lfs find -type d ============================="
+
+test_56k() {
+ setup_56_special $NUMFILES $NUMDIRS
+
+ EXPECTED=$(((NUMDIRS+1) * NUMFILES))
+ NUMS=`$LFIND -type f $DIR/${tdir}g | wc -l`
+ [ $NUMS -eq $EXPECTED ] || \
+ error "lfs find -type f $DIR/${tdir}g wrong: found $NUMS, expected $EXPECTED"
+}
+run_test 56k "check lfs find -type f ============================="
+
+test_56l() {
+ setup_56_special $NUMFILES $NUMDIRS
+
+ EXPECTED=$((NUMDIRS + NUMFILES))
+ NUMS=`$LFIND -type b $DIR/${tdir}g | wc -l`
+ [ $NUMS -eq $EXPECTED ] || \
+ error "lfs find -type b $DIR/${tdir}g wrong: found $NUMS, expected $EXPECTED"
+}
+run_test 56l "check lfs find -type b ============================="
+
+test_56m() {
+ setup_56_special $NUMFILES $NUMDIRS
+
+ EXPECTED=$((NUMDIRS + NUMFILES))
+ NUMS=`$LFIND -type c $DIR/${tdir}g | wc -l`
+ [ $NUMS -eq $EXPECTED ] || \
+ error "lfs find -type c $DIR/${tdir}g wrong: found $NUMS, expected $EXPECTED"
+}
+run_test 56m "check lfs find -type c ============================="
+
+test_56n() {
+ setup_56_special $NUMFILES $NUMDIRS
+
+ EXPECTED=$((NUMDIRS + NUMFILES))
+ NUMS=`$LFIND -type l $DIR/${tdir}g | wc -l`
+ [ $NUMS -eq $EXPECTED ] || \
+ error "lfs find -type l $DIR/${tdir}g wrong: found $NUMS, expected $EXPECTED"
+}
+run_test 56n "check lfs find -type l ============================="
+
+test_56o() {
+ setup_56 $NUMFILES $NUMDIRS
+ TDIR=$DIR/${tdir}g
+
+ utime $TDIR/file1 > /dev/null || error
+ utime $TDIR/file2 > /dev/null || error
+ utime $TDIR/dir1 > /dev/null || error
+ utime $TDIR/dir2 > /dev/null || error
+ utime $TDIR/dir1/file1 > /dev/null || error
+
+ EXPECTED=5
+ NUMS=`$LFIND -mtime +1 $TDIR | wc -l`
+ [ $NUMS -eq $EXPECTED ] || \
+ error "lfs find -mtime $TDIR wrong: found $NUMS, expected $EXPECTED"
+}
+run_test 56o "check lfs find -mtime for old files =========================="
+
test_57a() {
# note test will not do anything if MDS is not local
remote_mds && skip "remote MDS" && return
grep -q llite_lloop /proc/modules
[ $? -ne 0 ] && skip "can't find module llite_lloop" && return
+ [ -z "`$LCTL list_nids | grep -v tcp`" ] && \
+ skip "can't reliably test swap with TCP" && return
+
MEMTOTAL=`meminfo MemTotal`
NR_BLOCKS=$((MEMTOTAL>>8))
[[ $NR_BLOCKS -le 2048 ]] && NR_BLOCKS=2048
export ORIG_CSUM=""
set_checksums()
{
- [ "$ORIG_CSUM" ]||ORIG_CSUM=`cat $LPROC/llite/*/checksum_pages|head -n1`
- for f in $LPROC/llite/*/checksum_pages; do
+ [ "$ORIG_CSUM" ] || ORIG_CSUM=`cat $LPROC/osc/*/checksums | head -n1`
+ for f in $LPROC/osc/*/checksums; do
echo $1 >> $f
done
done
done
- cd ..
+ cd $DIR
star -c f=$TMP/f102.tar $tdir
SETUP_TEST102=yes
}
run_test 105c "lockf when mounted without -o flock test ========"
test_106() { #bug 10921
- mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
$DIR/$tdir && error "exec $DIR/$tdir succeeded"
chmod 777 $DIR/$tdir || error "chmod $DIR/$tdir failed"
}
run_test 115 "verify dynamic thread creation===================="
free_min_max () {
- AVAIL=($(cat $LPROC/osc/*[oO][sS][cC]-[^M]*/kbytesavail))
- echo OST kbytes available: ${AVAIL[@]}
+ wait_delete_completed
+ AVAIL=($(cat $LPROC/osc/*[oO][sS][cC]-[^M]*/kbytesavail))
+ echo OST kbytes available: ${AVAIL[@]}
MAXI=0; MAXV=${AVAIL[0]}
MINI=0; MINV=${AVAIL[0]}
for ((i = 0; i < ${#AVAIL[@]}; i++)); do
reset_async
#define OBD_FAIL_OST_ENOENT 0x217
- sysctl -w lustre.fail_loc=0x217
+ do_facet ost sysctl -w lustre.fail_loc=0x217
multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
RC=$?
- sysctl -w lustre.fail_loc=0
+ do_facet ost sysctl -w lustre.fail_loc=0
DIRTY=$(grep -c dirty $LPROC/llite/*/dump_page_cache)
WRITEBACK=$(grep -c writeback $LPROC/llite/*/dump_page_cache)
reset_async
#define OBD_FAIL_OST_EROFS 0x216
- sysctl -w lustre.fail_loc=0x216
+ do_facet ost sysctl -w lustre.fail_loc=0x216
# multiop should block due to fsync until pages are written
multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c &
error "No page in writeback, writeback=$WRITEBACK"
fi
- sysctl -w lustre.fail_loc=0
+ do_facet ost sysctl -w lustre.fail_loc=0
wait $MULTIPID
RC=$?
if [[ $RC -ne 0 ]]; then
reset_async
#define OBD_FAIL_OST_BRW_PAUSE_BULK
- sysctl -w lustre.fail_loc=0x214
+ do_facet ost sysctl -w lustre.fail_loc=0x214
# multiop should block due to fsync until pages are written
multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c &
MULTIPID=$!
fi
wait $MULTIPID || error "Multiop fsync failed, rc=$?"
+ do_facet ost sysctl -w lustre.fail_loc=0
DIRTY=$(grep -c dirty $LPROC/llite/*/dump_page_cache)
WRITEBACK=$(grep -c writeback $LPROC/llite/*/dump_page_cache)
# Should simulate EINVAL error which is fatal
multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
RC=$?
-
if [[ $RC -eq 0 ]]; then
error "Must return error due to dropped pages, rc=$RC"
fi
-
+
+ sysctl -w lustre.fail_loc=0x0
+
LOCKED=$(grep -c locked $LPROC/llite/*/dump_page_cache)
DIRTY=$(grep -c dirty $LPROC/llite/*/dump_page_cache)
WRITEBACK=$(grep -c writeback $LPROC/llite/*/dump_page_cache)
reset_async
#define OBD_FAIL_OST_BRW_WRITE_BULK 0x20e
- sysctl -w lustre.fail_loc=0x20e
+ do_facet ost sysctl -w lustre.fail_loc=0x20e
# Should simulate ENOMEM error which is recoverable and should be handled by timeout
multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
RC=$?
- sysctl -w lustre.fail_loc=0
+ do_facet ost sysctl -w lustre.fail_loc=0
if [[ $RC -eq 0 ]]; then
error "Must return error due to dropped pages, rc=$RC"
fi
reset_async
#define OBD_FAIL_OST_BRW_WRITE_BULK 0x20e
- sysctl -w lustre.fail_loc=0x20e
+ do_facet ost sysctl -w lustre.fail_loc=0x20e
# Should simulate ENOMEM error which is recoverable and should be handled by timeout
multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c &
PID=$!
sleep 5
- sysctl -w lustre.fail_loc=0
+ do_facet ost sysctl -w lustre.fail_loc=0
wait $PID
RC=$?
reset_async
#define OBD_FAIL_OST_BRW_WRITE_BULK2 0x220
- sysctl -w lustre.fail_loc=0x220
+ do_facet ost sysctl -w lustre.fail_loc=0x220
# return -EIO from OST
multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
RC=$?
- sysctl -w lustre.fail_loc=0x0
+ do_facet ost sysctl -w lustre.fail_loc=0x0
if [[ $RC -eq 0 ]]; then
error "Must return error due to dropped pages, rc=$RC"
fi
}
run_test 118j "Simulate unrecoverable OST side error =========="
+test_118k()
+{
+ #define OBD_FAIL_OST_BRW_WRITE_BULK 0x20e
+ do_facet ost sysctl -w lustre.fail_loc=0x20e
+ mkdir -p $DIR/$tdir
+
+ for ((i=0;i<10;i++)); do
+ dd if=/dev/zero of=$DIR/$tdir/$tdir-$i bs=1M count=10 &
+ SLEEPPID=$!
+ sleep 0.500s
+ kill $SLEEPPID
+ wait $SLEEPPID
+ done
+
+ sysctl -w lustre.fail_loc=0
+}
+run_test 118k "bio alloc -ENOMEM and IO TERM handling ========="
+
test_119a() # bug 11737
{
BSIZE=$((512 * 1024))
[ -z "`grep early_lock_cancel $LPROC/mdc/*/connect_flags`" ] && \
skip "no early lock cancel on server" && return 0
lru_resize_disable
- mkdir $DIR/$tdir
cancel_lru_locks mdc
stat $DIR/$tdir > /dev/null
can1=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats`
[ -z "`grep early_lock_cancel $LPROC/mdc/*/connect_flags`" ] && \
skip "no early lock cancel on server" && return 0
lru_resize_disable
- mkdir $DIR/$tdir
cancel_lru_locks mdc
stat $DIR/$tdir > /dev/null
can1=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats`
[ -z "`grep early_lock_cancel $LPROC/mdc/*/connect_flags`" ] && \
skip "no early lock cancel on server" && return 0
lru_resize_disable
- mkdir $DIR/$tdir
dd if=/dev/zero of=$DIR/$tdir/f1 count=1
cancel_lru_locks mdc
cancel_lru_locks osc
}
run_test 121 "read cancel race ========="
+cmd_cancel_lru_locks() {
+ NS=$1
+ test "x$NS" = "x" && NS="mdc"
+ for d in `find $LPROC/ldlm/namespaces | grep $NS`; do
+ if test -f $d/lru_size; then
+ cancel_lru_locks $d
+ fi
+ done
+}
+
test_124a() {
[ -z "`grep lru_resize $LPROC/mdc/*/connect_flags`" ] && \
skip "no lru resize on server" && return 0
- cancel_lru_locks mdc
+ cmd_cancel_lru_locks "mdc"
lru_resize_enable
- NSDIR=`find $LPROC/ldlm/namespaces | grep mdc | head -1`
# we want to test main pool functionality, that is cancel based on SLV
# this is why shrinkers are disabled
NR=2000
mkdir -p $DIR/$tdir || error "failed to create $DIR/$tdir"
- LRU_SIZE=`cat $NSDIR/lru_size`
-
# use touch to produce $NR new locks
log "create $NR files at $DIR/$tdir"
for ((i=0;i<$NR;i++)); do touch $DIR/$tdir/f$i; done
+
+ NSDIR=""
+ LRU_SIZE=0
+ for d in `find $LPROC/ldlm/namespaces | grep mdc-`; do
+ if test -f $d/lru_size; then
+ LRU_SIZE=`cat $d/lru_size`
+ if test $LRU_SIZE -gt 0; then
+ log "using $d namespace"
+ NSDIR=$d
+ break
+ fi
+ fi
+ done
- LRU_SIZE_B=`cat $NSDIR/lru_size`
- if test $LRU_SIZE -ge $LRU_SIZE_B; then
+ if test -z $NSDIR; then
skip "No cached locks created!"
- cat $NSDIR/pool/state
return 0
fi
- LRU_SIZE_B=$((LRU_SIZE_B-LRU_SIZE))
- log "created $LRU_SIZE_B lock(s)"
+
+ if test $LRU_SIZE -lt 100; then
+ skip "Not enough cached locks created!"
+ return 0
+ fi
+ log "created $LRU_SIZE lock(s)"
# we want to sleep 30s to not make test too long
SLEEP=30
# and we need to additionally enforce LVF to take this into account.
# Use $LRU_SIZE_B here to take into account real number of locks created
# in the case of CMD, LRU_SIZE_B != $NR in most of cases
- LVF=$(($LRU_SIZE_B * $MAX_HRS * 60 * 60))
+ LVF=$(($MAX_HRS * 60 * 60 * $LIMIT / $SLEEP))
+ LRU_SIZE_B=$LRU_SIZE
log "make client drop locks $LVF times faster so that ${SLEEP}s is enough to cancel $LRU_SIZE_B lock(s)"
OLD_LVF=`cat $NSDIR/pool/lock_volume_factor`
echo "$LVF" > $NSDIR/pool/lock_volume_factor
echo "$OLD_LVF" > $NSDIR/pool/lock_volume_factor
LRU_SIZE_A=`cat $NSDIR/lru_size`
- [ $LRU_SIZE_B -ge $LRU_SIZE_A ] || {
+ [ $LRU_SIZE_B -gt $LRU_SIZE_A ] || {
error "No locks dropped in "$((SLEEP+SLEEP_ADD))"s. LRU size: $LRU_SIZE_A"
lru_resize_enable
unlinkmany $DIR/$tdir/f $NR
}
run_test 124a "lru resize ======================================="
+set_lru_size() {
+ NS=$1
+ SIZE=$2
+ test "x$NS" = "x" && NS="mdc"
+ test "x$SIZE" = "x" && SIZE="0"
+ test $SIZE -lt 0 && SIZE="0"
+ test $SIZE -gt 0 && ACTION="disabled" || ACTION="enabled"
+ for d in `find $LPROC/ldlm/namespaces | grep $NS`; do
+ if test -f $d/lru_size; then
+ log "$(basename $d):"
+ log " lru resize $ACTION"
+ log " lru_size=$SIZE"
+ echo $SIZE > $d/lru_size
+ fi
+ done
+}
+
+get_lru_size() {
+ NS=$1
+ test "x$NS" = "x" && NS="mdc"
+ for d in `find $LPROC/ldlm/namespaces | grep $NS`; do
+ if test -f $d/lru_size; then
+ log "$(basename $d):"
+ log " lru_size=$(cat $d/lru_size)"
+ fi
+ done
+}
+
test_124b() {
[ -z "`grep lru_resize $LPROC/mdc/*/connect_flags`" ] && \
skip "no lru resize on server" && return 0
- cleanup -f || error "failed to unmount"
- MOUNTOPT="$MOUNTOPT,nolruresize"
- setup
- NR=3000
- mkdir -p $DIR/$tdir || error "failed to create $DIR/$tdir"
+ NSDIR=`find $LPROC/ldlm/namespaces | grep mdc | head -1`
+ LIMIT=`cat $NSDIR/pool/limit`
+
+ NR_CPU=$(awk '/processor/' /proc/cpuinfo | wc -l)
+ # 100 locks here is default value for non-shrinkable lru as well
+ # as the order to switch to static lru managing policy
+ # define LDLM_DEFAULT_LRU_SIZE (100 * num_online_cpus())
+ LDLM_DEFAULT_LRU_SIZE=$((100 * NR_CPU))
+
+ NR=$((LIMIT-(LIMIT/3)))
+ log "starting lru resize disable cycle"
+ set_lru_size "mdc-" $LDLM_DEFAULT_LRU_SIZE
+
+ mkdir -p $DIR/$tdir/disable_lru_resize ||
+ error "failed to create $DIR/$tdir/disable_lru_resize"
- createmany -o $DIR/$tdir/f $NR
- log "doing ls -la $DIR/$tdir 3 times (lru resize disabled)"
+ createmany -o $DIR/$tdir/disable_lru_resize/f $NR
+ log "doing ls -la $DIR/$tdir/disable_lru_resize 3 times"
stime=`date +%s`
- ls -la $DIR/$tdir > /dev/null
- ls -la $DIR/$tdir > /dev/null
- ls -la $DIR/$tdir > /dev/null
+ ls -la $DIR/$tdir/disable_lru_resize > /dev/null
+ ls -la $DIR/$tdir/disable_lru_resize > /dev/null
+ ls -la $DIR/$tdir/disable_lru_resize > /dev/null
etime=`date +%s`
nolruresize_delta=$((etime-stime))
log "ls -la time: $nolruresize_delta seconds"
+ get_lru_size "mdc-"
+
+ log "starting lru resize enable cycle"
+ mkdir -p $DIR/$tdir/enable_lru_resize ||
+ error "failed to create $DIR/$tdir/enable_lru_resize"
- cleanup -f || error "failed to unmount"
- MOUNTOPT=`echo $MOUNTOPT | sed "s/nolruresize/lruresize/"`
- setup
+ # 0 locks means here flush lru and switch to lru resize policy
+ set_lru_size "mdc-" 0
- createmany -o $DIR/$tdir/f $NR
- log "doing ls -la $DIR/$tdir 3 times (lru resize enabled)"
+ createmany -o $DIR/$tdir/enable_lru_resize/f $NR
+ log "doing ls -la $DIR/$tdir/enable_lru_resize 3 times"
stime=`date +%s`
- ls -la $DIR/$tdir > /dev/null
- ls -la $DIR/$tdir > /dev/null
- ls -la $DIR/$tdir > /dev/null
+ ls -la $DIR/$tdir/enable_lru_resize > /dev/null
+ ls -la $DIR/$tdir/enable_lru_resize > /dev/null
+ ls -la $DIR/$tdir/enable_lru_resize > /dev/null
etime=`date +%s`
lruresize_delta=$((etime-stime))
log "ls -la time: $lruresize_delta seconds"
+ get_lru_size "mdc-"
if test $lruresize_delta -gt $nolruresize_delta; then
log "ls -la is $((lruresize_delta - $nolruresize_delta))s slower with lru resize enabled"
else
log "lru resize performs the same with no lru resize"
fi
-
- unlinkmany $DIR/$tdir/f $NR
}
run_test 124b "lru resize (performance test) ======================="
}
run_test 125 "don't return EPROTO when a dir has a non-default striping and ACLs"
+test_126() { # bug 12829/13455
+ [ "$UID" != 0 ] && echo "skipping $TESTNAME (must run as root)" && return
+ $RUNAS -u 0 -g 1 touch $DIR/$tfile || error "touch failed"
+ gid=`ls -n $DIR/$tfile | awk '{print $4}'`
+ rm -f $DIR/$tfile
+ [ $gid -eq "1" ] || error "gid is set to" $gid "instead of 1"
+}
+run_test 126 "check that the fsgid provided by the client is taken into account"
+
TMPDIR=$OLDTMPDIR
TMP=$OLDTMP
HOME=$OLDHOME