set -e
ONLY=${ONLY:-"$*"}
-# bug number for skipped test: 3192 15528/3811 16929 9977 15528/11549
-ALWAYS_EXCEPT=" 14b 19 22 28 29 $SANITYN_EXCEPT"
+# bug number for skipped test: 3192 15528/3811 16929 9977 15528/11549 18080
+ALWAYS_EXCEPT=" 14b 19 22 28 29 35 $SANITYN_EXCEPT"
# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
# bug number for skipped test: 12652 12652
SIZE=${SIZE:-40960}
CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
-CREATETEST=${CREATETEST:-createtest}
GETSTRIPE=${GETSTRIPE:-lfs getstripe}
SETSTRIPE=${SETSTRIPE:-lstripe}
MCREATE=${MCREATE:-mcreate}
OPENFILE=${OPENFILE:-openfile}
OPENUNLINK=${OPENUNLINK:-openunlink}
-TOEXCL=${TOEXCL:-toexcl}
TRUNCATE=${TRUNCATE:-truncate}
export TMP=${TMP:-/tmp}
MOUNT_2=${MOUNT_2:-"yes"}
init_test_env $@
. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
-[ "$SLOW" = "no" ] && EXCEPT_SLOW="12 16 33a"
+[ "$SLOW" = "no" ] && EXCEPT_SLOW="12 16 23 33a"
SANITYLOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
FAIL_ON_ERROR=false
run_test 17 "resource creation/LVB creation race ==============="
test_18() {
- ./mmap_sanity -d $MOUNT1 -m $MOUNT2
+ $LUSTRE/tests/mmap_sanity -d $MOUNT1 -m $MOUNT2
sync; sleep 1; sync
}
run_test 18 "mmap sanity check ================================="
cat $DIR2/d21/no_joined || error "cat error"
rm -rf $DIR2/d21/no_joined || error "unlink normal file error"
}
-run_test 22 " After joining in one dir, open/close unlink file in anther dir"
+run_test 22 " After joining in one dir, open/close unlink file in anther dir"
test_23() { # Bug 5972
echo "others should see updated atime while another read" > $DIR1/f23
cancel_lru_locks osc
time1=`date +%s`
- sleep 2
+ #MAX_ATIME_DIFF 60, we update atime only if older than 60 seconds
+ sleep 61
multiop_bg_pause $DIR1/f23 or20_c || return 1
- MULTIPID=$!
+ # with SOM and opencache enabled, we need to close a file and cancel
+ # open lock to get atime propogated to MDS
+ kill -USR1 $!
+ cancel_lru_locks mdc
time2=`stat -c "%X" $DIR2/f23`
if (( $time2 <= $time1 )); then
- kill -USR1 $MULTIPID
error "atime doesn't update among nodes"
fi
- kill -USR1 $MULTIPID || return 1
rm -f $DIR1/f23 || error "rm -f $DIR1/f23 failed"
true
}
chmod a+x $DIR2/$tfile
mt1=`stat -c %Y $DIR1/$tfile`
mt2=`stat -c %Y $DIR2/$tfile`
-
- if [ x"$mt1" != x"$mt2" ]; then
+
+ if [ x"$mt1" != x"$mt2" ]; then
error "not equal mtime, client1: "$mt1", client2: "$mt2"."
fi
}
tECHOID=`$LCTL dl | grep $ECHO_UUID | awk '{print $1}'`
$LCTL --device $tECHOID destroy "${tOBJID}:0"
-
+
$LCTL <<-EOF
cfg_device ECHO_osc1
cleanup
save_lustre_params $node "ldlm.namespaces.filter-*.contention_seconds" >> $p
done
clear_osc_stats
- # agressive lockless i/o settings
+ # agressive lockless i/o settings
for node in $(osts_nodes); do
do_node $node 'lctl set_param -n ldlm.namespaces.filter-*.max_nolock_bytes 2000000; lctl set_param -n ldlm.namespaces.filter-*.contended_locks 0; lctl set_param -n ldlm.namespaces.filter-*.contention_seconds 60'
done
dd if=/dev/zero of=$DIR1/$tfile bs=4k count=1 conv=notrunc > /dev/null 2>&1
dd if=/dev/zero of=$DIR2/$tfile bs=4k count=1 conv=notrunc > /dev/null 2>&1
done
- [ $(calc_osc_stats lockless_write_bytes) -ne 0 ] || error "lockless i/o was not triggered"
+ [ $(calc_osc_stats lockless_write_bytes) -ne 0 ] || error "lockless i/o was not triggered"
# disable lockless i/o (it is disabled by default)
for node in $(osts_nodes); do
do_node $node 'lctl set_param -n ldlm.namespaces.filter-*.max_nolock_bytes 0; lctl set_param -n ldlm.namespaces.filter-*.contended_locks 32; lctl set_param -n ldlm.namespaces.filter-*.contention_seconds 0'
dd if=/dev/zero of=$DIR2/$tfile bs=4k count=1 conv=notrunc > /dev/null 2>&1
done
[ $(calc_osc_stats lockless_write_bytes) -eq 0 ] ||
- error "lockless i/o works when disabled"
+ error "lockless i/o works when disabled"
rm -f $DIR1/$tfile
restore_lustre_params <$p
rm -f $p
run_test 32b "lockless i/o"
print_jbd_stat () {
- local dev=$(basename $(do_facet $SINGLEMDS lctl get_param -n osd.*MDT*.mntdev))
- do_facet $SINGLEMDS cat /proc/fs/jbd/$dev/info | head -1
-}
-
-do_and_time () {
- local cmd=$1
-
- local start_ts=`date +%s`
-
- $cmd
-
- current_ts=`date +%s`
- ELAPSED=`expr $current_ts - $start_ts`
+ local dev
+ local mdts=$(get_facets MDS)
+ local varcvs
+ local mds
+
+ local stat=0
+ for mds in ${mdts//,/ }; do
+ varsvc=${mds}_svc
+ dev=$(basename $(do_facet $mds lctl get_param -n osd.${!varsvc}.mntdev))
+ val=$(do_facet $mds cat /proc/fs/jbd/$dev/info | head -1 | cut -d" " -f1)
+ stat=$(( stat + val))
+ done
+ echo $stat
}
# commit on sharing tests
local nfiles=${TEST33_NFILES:-10000}
local param_file=$TMP/$tfile-params
- save_lustre_params $(facet_active_host $SINGLEMDS) "mdt.*.commit_on_sharing" > $param_file
+ save_lustre_params $(comma_list $(mdts_nodes)) "mdt.*.commit_on_sharing" > $param_file
local COS
local jbdold
avgjbd=0
avgtime=0
for i in 1 2 3; do
-
do_nodes $CLIENT1,$CLIENT2 "mkdir -p $DIR1/$tdir-\\\$(hostname)-$i"
- jbdold=$(print_jbd_stat)
- echo "=== START createmany $jbdold"
- do_and_time "do_nodes $CLIENT1,$CLIENT2 createmany -o $DIR1/$tdir-\\\$(hostname)-$i/f- -r $DIR2/$tdir-\\\$(hostname)-$i/f- $nfiles"
+ jbdold=$(print_jbd_stat)
+ echo "=== START createmany old: $jbdold transaction"
+ local elapsed=$(do_and_time "do_nodes $CLIENT1,$CLIENT2 createmany -o $DIR1/$tdir-\\\$(hostname)-$i/f- -r $DIR2/$tdir-\\\$(hostname)-$i/f- $nfiles > /dev/null 2>&1")
jbdnew=$(print_jbd_stat)
- jbd=$((`echo $jbdnew | cut -d" " -f1` - `echo $jbdold | cut -d" " -f1`))
- echo "=== END createmany $jbdnew : $jbd transactions nfiles $nfiles time $ELAPSED COS=$COS"
+ jbd=$(( jbdnew - jbdold ))
+ echo "=== END createmany new: $jbdnew transaction : $jbd transactions nfiles $nfiles time $ELAPSED COS=$COS"
avgjbd=$(( avgjbd + jbd ))
- avgtime=$(( avgtime + ELAPSED ))
+ avgtime=$(( avgtime + elapsed ))
done
eval cos${COS}_jbd=$((avgjbd / 3))
eval cos${COS}_time=$((avgtime / 3))
done
echo "COS=0 transactions (avg): $cos0_jbd time (avg): $cos0_time"
- echo "COS=1 transactions (avg): $cos1_jbd time (avg): $cos1_time"
+ echo "COS=1 transactions (avg): $cos1_jbd time (avg): $cos1_time"
[ "$cos0_jbd" != 0 ] && echo "COS=1 vs COS=0 jbd: $((((cos1_jbd/cos0_jbd - 1)) * 100 )) %"
[ "$cos0_time" != 0 ] && echo "COS=1 vs COS=0 time: $((((cos1_time/cos0_time - 1)) * 100 )) %"
echo writing on client1
dd if=/dev/zero of=$DIR1/$tfile count=100 conv=notrunc > /dev/null 2>&1
sync &
- # wait for the flush
- sleep 1
echo reading on client2
dd of=/dev/null if=$DIR2/$tfile > /dev/null 2>&1
# wait for a lock timeout
sleep 4
lock_out=$(do_nodes $(osts_nodes) "lctl get_param -n ldlm.namespaces.filter-*.lock_timeouts" | calc_sum)
- if [ $OPER == "timeout" ] ; then
+ if [ $OPER == "timeout" ] ; then
if [ $lock_in == $lock_out ]; then
error "no lock timeout happened"
else
done
mkdir -p $MOUNT1/$tfile
- createmany -o $MOUNT1/$tfile/a 2000
- sync
cancel_lru_locks mdc
# Let's initiate -EINTR situation by setting fail_loc and take
# bl_ast yet as lock is already in local cache.
#define OBD_FAIL_LDLM_INTR_CP_AST 0x317
do_facet client "lctl set_param fail_loc=0x80000317"
- ls -la $MOUNT1/$tfile > /dev/null &
- pid1=$!
- sleep 1
-
- # Let's take write lock on same file from another mount. This
- # should cause conflict and bl_ast
- createmany -o $MOUNT2/$tfile/a 2000 &
- pid2=$!
local timeout=`do_facet $SINGLEMDS lctl get_param -n timeout`
let timeout=timeout*3
- log "Wait for $pid1 $pid2 for $timeout sec..."
- sleep $timeout
- kill -9 $pid1 $pid2 > /dev/null 2>&1
- wait
+ local nr=0
+ while test $nr -lt 10; do
+ log "Race attempt $nr"
+ local blk1=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'`
+ test "x$blk1" = "x" && blk1=0
+ createmany -o $MOUNT2/$tfile/a 4000 &
+ pid1=$!
+ sleep 1
+
+ # Let's make conflict and bl_ast
+ ls -la $MOUNT1/$tfile > /dev/null &
+ pid2=$!
+
+ log "Wait for $pid1 $pid2 for $timeout sec..."
+ sleep $timeout
+ kill -9 $pid1 $pid2 > /dev/null 2>&1
+ wait
+ local blk2=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'`
+ test "x$blk2" = "x" && blk2=0
+ test $blk2 -gt $blk1 && break
+ rm -fr $MOUNT1/$tfile/*
+ cancel_lru_locks mdc
+ let nr=nr+1
+ done
do_facet client "lctl set_param fail_loc=0x0"
df -h $MOUNT1 $MOUNT2
count=0
}
run_test 35 "-EINTR cp_ast vs. bl_ast race does not evict client"
+test_36() { #bug 16417
+ local SIZE
+ local SIZE_B
+ local i
+
+ mkdir -p $DIR1/$tdir
+ $LFS setstripe -c -1 $DIR1/$tdir
+ i=0
+ SIZE=50
+ let SIZE_B=SIZE*1024*1024
+
+ while [ $i -le 10 ]; do
+ lctl mark "start test"
+ local before=$($LFS df | awk '{if ($1 ~/^filesystem/) {print $5; exit} }')
+ dd if=/dev/zero of=$DIR1/$tdir/file000 bs=1M count=$SIZE
+ sync
+ sleep 1
+ local after_dd=$($LFS df | awk '{if ($1 ~/^filesystem/) {print $5; exit} }')
+ multiop_bg_pause $DIR2/$tdir/file000 O_r${SIZE_B}c || return 3
+ read_pid=$!
+ rm -f $DIR1/$tdir/file000
+ kill -USR1 $read_pid
+ wait $read_pid
+ sleep 1
+ local after=$($LFS df | awk '{if ($1 ~/^filesystem/) {print $5; exit} }')
+ echo "*** cycle($i) *** before($before):after_dd($after_dd):after($after)"
+ # this free space! not used
+ if [ $after_dd -ge $after ]; then
+ error "space leaked"
+ return 1;
+ fi
+ let i=i+1
+ done
+}
+run_test 36 "handle ESTALE/open-unlink corectly"
+
log "cleanup: ======================================================"
check_and_cleanup_lustre