Whamcloud - gitweb
LU-2189 tests: EXCEPT sanityn/36 for ZFS
[fs/lustre-release.git] / lustre / tests / sanityn.sh
index 1944a15..07a4fb8 100644 (file)
@@ -41,10 +41,10 @@ init_test_env $@
 init_logging
 
 [ $(facet_fstype $SINGLEMDS) = "zfs" ] &&
-# bug number for skipped test:        LU-2840 LU-2776
-       ALWAYS_EXCEPT="$ALWAYS_EXCEPT 21      51a"
+# bug number for skipped test:        LU-2840 LU-2189 LU-2776
+       ALWAYS_EXCEPT="$ALWAYS_EXCEPT 21      36      51a"
 
-[ "$SLOW" = "no" ] && EXCEPT_SLOW="12 23 33a"
+[ "$SLOW" = "no" ] && EXCEPT_SLOW="33a"
 
 FAIL_ON_ERROR=false
 
@@ -57,7 +57,7 @@ LOVNAME=$($LCTL get_param -n llite.*.lov.common_name | tail -n 1)
 OSTCOUNT=$($LCTL get_param -n lov.$LOVNAME.numobd)
 
 assert_DIR
-rm -rf $DIR1/[df][0-9]* $DIR1/lnk
+rm -rf $DIR1/[df][0-9]* $DIR1/lnk $DIR/[df].${TESTSUITE}*
 
 SAMPLE_FILE=$TMP/$(basename $0 .sh).junk
 dd if=/dev/urandom of=$SAMPLE_FILE bs=1M count=1
@@ -829,11 +829,10 @@ print_jbd_stat () {
     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 "procfile=/proc/fs/jbd/$dev/info;
-[ -f \\\$procfile ] || procfile=/proc/fs/jbd2/$dev/info;
-[ -f \\\$procfile ] || procfile=/proc/fs/jbd2/${dev}\:\\\*/info;
-cat \\\$procfile | head -1;")
+        dev=$(basename $(do_facet $mds "lctl get_param -n osd*.${!varsvc}.mntdev|\
+               xargs readlink -f" ))
+        val=$(do_facet $mds "cat /proc/fs/jbd*/${dev}{,:*,-*}/info 2>/dev/null|\
+               head -1")
         val=${val%% *};
         stat=$(( stat + val))
     done
@@ -844,18 +843,19 @@ cat \\\$procfile | head -1;")
 test_33a() {
     remote_mds_nodsh && skip "remote MDS with nodsh" && return
 
-    [ -n "$CLIENTS" ] || { skip "Need two or more clients" && return 0; }
-    [ $CLIENTCOUNT -ge 2 ] || \
-        { skip "Need two or more clients, have $CLIENTCOUNT" && return 0; }
+    [ -z "$CLIENTS" ] && skip "Need two or more clients, have $CLIENTS" && return 0
+    [ $CLIENTCOUNT -lt 2 ] &&
+       skip "Need two or more clients, have $CLIENTCOUNT" && return 0
 
     local nfiles=${TEST33_NFILES:-10000}
     local param_file=$TMP/$tfile-params
+    local fstype=$(facet_fstype $SINGLEMDS)
 
     save_lustre_params $(comma_list $(mdts_nodes)) "mdt.*.commit_on_sharing" > $param_file
 
     local COS
-    local jbdold
-    local jbdnew
+    local jbdold="N/A"
+    local jbdnew="N/A"
     local jbd
 
     for COS in 0 1; do
@@ -865,13 +865,13 @@ test_33a() {
         for i in 1 2 3; do
             do_nodes $CLIENT1,$CLIENT2 "mkdir -p $DIR1/$tdir-\\\$(hostname)-$i"
 
-            jbdold=$(print_jbd_stat)
+            [ $fstype = ldiskfs ] && 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=$(( jbdnew - jbdold ))
+            [ $fstype = ldiskfs ] && jbdnew=$(print_jbd_stat)
+            [ $fstype = ldiskfs ] && jbd=$(( jbdnew - jbdold ))
             echo "=== END   createmany new: $jbdnew transaction :  $jbd transactions  nfiles $nfiles time $elapsed COS=$COS"
-            avgjbd=$(( avgjbd + jbd ))
+            [ $fstype = ldiskfs ] && avgjbd=$(( avgjbd + jbd ))
             avgtime=$(( avgtime + elapsed ))
         done
         eval cos${COS}_jbd=$((avgjbd / 3))
@@ -1082,33 +1082,29 @@ test_36() { #bug 16417
        i=0
        SIZE=50
        let SIZE_B=SIZE*1024*1024
+       sync; sleep 5; sync # wait for delete thread
 
        while [ $i -le 10 ]; do
                lctl mark "start test"
-               local before=$($LFS df | awk '{ if ($1 ~/^filesystem/) \
-                                             { print $5; exit} }')
+               local before=$(lfs_df $MOUNT1 | awk '/^filesystem/{ print $4; exit }')
                dd if=/dev/zero of=$DIR1/$tdir/$tfile bs=1M count=$SIZE ||
                        error "dd $DIR1/$tdir/$tfile ${SIZE}MB failed"
                sync          # sync data from client cache
                sync_all_data # sync data from server cache (delayed allocation)
-               sleep 1
-               local after_dd=$($LFS df | awk '{ if ($1 ~/^filesystem/) \
-                                               { print $5; exit} }')
+               sleep 2
+               local after_dd=$(lfs_df $MOUNT1 | awk '/^filesystem/{ print $4; exit }')
                multiop_bg_pause $DIR2/$tdir/$tfile O_r${SIZE_B}c || return 3
                read_pid=$!
                rm -f $DIR1/$tdir/$tfile
                kill -USR1 $read_pid
                wait $read_pid
                wait_delete_completed
-               local after=$($LFS df | awk '{ if ($1 ~/^filesystem/) \
-                                            { print $5; exit} }')
+               local after=$(lfs_df $MOUNT1 | awk '/^filesystem/{ print $4; 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
+               (( $after_dd <= $after)) ||
+                       error "space leaked after_dd:$after_dd > after:$after"
                let i=i+1
        done
 }