Whamcloud - gitweb
b=18695
[fs/lustre-release.git] / lustre / tests / sanityN.sh
index 5c1b30b..6e5e024 100644 (file)
@@ -3,8 +3,8 @@
 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
@@ -44,7 +44,7 @@ SETUP=${SETUP:-:}
 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
@@ -348,7 +348,7 @@ test_17() { # bug 3513, 3667
 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 ================================="
@@ -436,19 +436,21 @@ test_23() { # Bug 5972
        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
 }
@@ -709,19 +711,19 @@ test_32b() { # bug 11270
 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
@@ -738,7 +740,7 @@ test_33a() {
     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
@@ -750,17 +752,16 @@ test_33a() {
         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"
+            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))
@@ -896,6 +897,7 @@ test_36() { #bug 16417
         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=$!
@@ -915,6 +917,21 @@ test_36() { #bug 16417
 }
 run_test 36 "handle ESTALE/open-unlink corectly"
 
+test_37() { # bug 18695
+       mkdir -p $DIR1/$tdir
+       multiop_bg_pause $DIR1/$tdir D_c || return 1
+       MULTIPID=$!
+       # create large directory (32kB seems enough from e2fsck, ~= 1000 files)
+       createmany -m $DIR2/$tdir/f 10000
+       # set mtime/atime backward
+       touch -t 198001010000 $DIR2/$tdir
+       kill -USR1 $MULTIPID
+       nr_files=`lfs find $DIR1/$tdir -type f | wc -l`
+       [ $nr_files -eq 10000 ] || error "$nr_files != 10000 truncated directory?"
+
+}
+run_test 37 "check i_size is not updated for directory on close (bug 18695) =============="
+
 log "cleanup: ======================================================"
 
 check_and_cleanup_lustre