Whamcloud - gitweb
LU-10092 pcc: change detach behavior and add keep option
[fs/lustre-release.git] / lustre / tests / sanity-dom.sh
index 765b9bc..01bedae 100644 (file)
@@ -7,6 +7,7 @@
 set -e
 
 ONLY=${ONLY:-"$*"}
+# bug number for skipped test:
 ALWAYS_EXCEPT="$SANITY_DOM_EXCEPT"
 [ "$SLOW" = "no" ] && EXCEPT_SLOW=""
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
@@ -20,6 +21,18 @@ init_test_env $@
 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 init_logging
 
+if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
+# bug number for skipped test:
+       ALWAYS_EXCEPT+=""
+       if [ $MDSCOUNT -gt 1 ]; then
+# bug number for skipped test:
+               ALWAYS_EXCEPT+=""
+       fi
+fi
+
+[[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.56) ]] ||
+       { skip "Need MDS version at least 2.10.56"; exit 0; }
+
 MULTIOP=${MULTIOP:-multiop}
 OPENFILE=${OPENFILE:-openfile}
 MOUNT_2=${MOUNT_2:-"yes"}
@@ -39,13 +52,7 @@ DOM="yes"
 DOM_SIZE=${DOM_SIZE:-"$((1024*1024))"}
 OSC="mdc"
 
-trap restore_default_layout EXIT
-restore_default_layout() {
-       [ -n "$saved_layout" ] && restore_layout $DIR1 $saved_layout ||
-               $LFS setstripe -d $DIR1
-}
-
-saved_layout=$(save_layout $DIR1)
+save_layout_restore_at_exit $DIR1
 $LFS setstripe -E $DOM_SIZE -L mdt -E EOF $DIR1
 
 mkdir -p $MOUNT2
@@ -89,6 +96,30 @@ test_3() {
 }
 run_test 3 "Truncate over DoM size on different nodes"
 
+test_4() {
+       local before=0
+       local after=0
+
+       dd if=/dev/zero of=$DIR1/$tfile bs=2M count=1
+       cancel_lru_locks mdc
+
+       #define OBD_FAIL_MDC_GLIMPSE_DDOS 0x808
+       $LCTL set_param fail_loc=0x80000808
+       before=$(lctl get_param -n ldlm.namespaces.*mdc*.lock_count |
+               gawk '{cnt=cnt+$1}  END{print cnt}')
+       for ((i=1; i < 100; i++))
+       do
+               tail -n100 $DIR1/$tfile > /dev/null
+               stat -f $DIR2/$tfile > /dev/null
+       done
+       after=$(lctl get_param -n ldlm.namespaces.*mdc*.lock_count |
+               gawk '{cnt=cnt+$1}  END{print cnt}')
+       [[ $((after - before)) -ge 20 ]] &&
+               error "Too many locks found $((after - before))"
+       return 0
+}
+run_test 4 "DoM: glimpse doesn't produce duplicated locks"
+
 test_fsx() {
        local file1=$DIR1/$tfile
        local file2=$DIR2/$tfile
@@ -100,25 +131,20 @@ run_test fsx "Dual-mount fsx with DoM files"
 
 test_sanity()
 {
-       local SAVE_ONLY=$ONLY
-
-       [ ! -f sanity.sh ] && skip_env "No sanity.sh skipping" && return
-       # XXX: to fix 45
-       ONLY="36 39 40 41 42 43 46 56r 101e 119a 131 150 155a 155b 155c \
-               155d 207 241 251" OSC="mdc" DOM="yes" sh sanity.sh
-       ONLY=$SAVE_ONLY
+       # XXX: to fix 45. Add 42a, c when LU-9693 fixed.
+       # Add 42b when LU-6493 fixed
+       # Enable 39k when LU-10496 fixed
+       ONLY="36 39 40 41 42d 42e 43 46 56r 101e 119a 131 150 155a 155b 155c \
+               155d 207 241 251" \
+               EXCEPT=39k OSC="mdc" DOM="yes" bash sanity.sh
 }
 run_test sanity "Run sanity with Data-on-MDT files"
 
 test_sanityn()
 {
-       local SAVE_ONLY=$ONLY
-
-       [ ! -f sanity.sh ] && skip_env "No sanity.sh skipping" && return
        # XXX: to fix 60
        ONLY="1 2 4 5 6 7 8 9 10 11 12 14 17 19 20 23 27 39 51a 51c 51d" \
-               OSC="mdc" DOM="yes" sh sanityn.sh
-       ONLY=$SAVE_ONLY
+               OSC="mdc" DOM="yes" bash sanityn.sh
 }
 run_test sanityn "Run sanityn with Data-on-MDT files"