Whamcloud - gitweb
LU-10810 clio: SEEK_HOLE/SEEK_DATA on client side
[fs/lustre-release.git] / lustre / tests / sanity-hsm.sh
index 01f7e0a..8bbdc50 100755 (executable)
@@ -16,8 +16,8 @@ init_logging
 
 ALWAYS_EXCEPT="$SANITY_HSM_EXCEPT "
 if $SHARED_KEY; then
-# bug number for skipped tests: LU-9795 LU-9795
-       ALWAYS_EXCEPT+="        13      402b "
+# bug number for skipped tests: LU-9795
+       ALWAYS_EXCEPT+="        402b "
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 fi
 
@@ -84,7 +84,7 @@ CLIENT2=${CLIENT2:-$CLIENT1}
 
 search_copytools() {
        local hosts=${1:-$(facet_active_host $SINGLEAGT)}
-       do_nodesv $hosts "pgrep -x $HSMTOOL_PKILL"
+       do_nodesv $hosts "libtool execute pgrep -x $HSMTOOL"
 }
 
 wait_copytools() {
@@ -92,7 +92,7 @@ wait_copytools() {
        local wait_timeout=200
        local wait_start=$SECONDS
        local wait_end=$((wait_start + wait_timeout))
-       local sleep_time=100000 # 0.1 second
+       local sleep_time=1
 
        while ((SECONDS < wait_end)); do
                if ! search_copytools $hosts; then
@@ -101,9 +101,8 @@ wait_copytools() {
                fi
 
                echo "copytools still running on $hosts"
-               usleep $sleep_time
-               [ $sleep_time -lt 32000000 ] && # 3.2 seconds
-                       sleep_time=$(bc <<< "$sleep_time * 2")
+               sleep $sleep_time
+               [ $sleep_time -lt 5 ] && sleep_time=$((sleep_time + 1))
        done
 
        # try to dump Copytool's stack
@@ -170,8 +169,8 @@ copytool_suspend() {
        local agents=${1:-$(facet_active_host $SINGLEAGT)}
 
        stack_trap \
-               "do_nodesv $agents pkill -CONT -x '$HSMTOOL_PKILL' || true" EXIT
-       do_nodesv $agents "pkill -STOP -x $HSMTOOL_PKILL" || return 0
+               "do_nodesv $agents libtool execute pkill -CONT -x '$HSMTOOL' || true" EXIT
+       do_nodesv $agents "libtool execute pkill -STOP -x $HSMTOOL" || return 0
        echo "Copytool is suspended on $agents"
 }
 
@@ -489,7 +488,7 @@ get_agent_uuid() {
 
        # Lustre mount-point is mandatory and last parameter on
        # copytool cmd-line.
-       local mntpnt=$(do_rpc_nodes $agent ps -C $HSMTOOL_KILL -o args= |
+       local mntpnt=$(do_rpc_nodes $agent libtool execute ps -C $HSMTOOL -o args= |
                       awk '{print $NF}')
        [ -n "$mntpnt" ] || error "Found no Agent or with no mount-point "\
                                  "parameter"
@@ -1341,6 +1340,26 @@ test_12q() {
 }
 run_test 12q "file attributes are refreshed after restore"
 
+test_12r() {
+       # test needs a running copytool
+       copytool setup
+
+       mkdir -p $DIR/$tdir
+       local f=$DIR/$tdir/$tfile
+       local fid=$(copy_file /etc/hosts $f)
+
+       $LFS hsm_archive $f || error "archive of $f failed"
+       wait_request_state $fid ARCHIVE SUCCEED
+       $LFS hsm_release $f || error "release of $f failed"
+
+       offset=$(lseek_test -d 7 $f)
+
+       # we check we had a restore done
+       wait_request_state $fid RESTORE SUCCEED
+       [[ $offset == 7 ]] || error "offset $offset != 7"
+}
+run_test 12r "lseek restores released file"
+
 test_13() {
        local -i i j k=0
        for i in {1..10}; do
@@ -5007,6 +5026,7 @@ test_407() {
        md5sum $f2 &
        sleep 2
 
+       do_facet $SINGLEMDS "$LCTL get_param $HSM_PARAM.actions"
        # after umount hsm_actions->O/x/x log shouldn't have
        # double RESTORE records like below
        #[0x200000401:0x1:0x0]...0x58d03a0d/0x58d03a0c action=RESTORE...WAITING
@@ -5014,9 +5034,12 @@ test_407() {
        sleep 30 &&
                do_facet $SINGLEMDS "$LCTL get_param $HSM_PARAM.actions"&
        fail $SINGLEMDS
+       do_facet $SINGLEMDS $LCTL set_param fail_loc=0
+
+       do_facet $SINGLEMDS "$LCTL get_param $HSM_PARAM.actions"
 
        copytool_continue
-       wait_request_state $fid RESTORE SUCCEED
+       wait_all_done 100 $fid
 }
 run_test 407 "Check for double RESTORE records in llog"