Whamcloud - gitweb
LU-9477 tests: check correct handling of dead object
[fs/lustre-release.git] / lustre / tests / sanity-hsm.sh
index c1d7490..a1cdb1b 100755 (executable)
@@ -3333,6 +3333,23 @@ test_60() {
 }
 run_test 60 "Changing progress update interval from default"
 
+test_61() {
+       # test needs a running copytool
+       copytool_setup
+
+       mkdir -p $DIR/$tdir
+       local f=$DIR/$tdir/$tfile
+       local fid=$(copy_file /etc/passwd $f)
+       cdt_disable
+       $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
+       rm -f $f
+       cdt_enable
+       wait_request_state $fid ARCHIVE FAILED
+
+       copytool_cleanup
+}
+run_test 61 "Waiting archive of a removed file should fail"
+
 test_70() {
        # test needs a new running copytool
        copytool_cleanup
@@ -4574,6 +4591,43 @@ test_251() {
 }
 run_test 251 "Coordinator request timeout"
 
+test_252() {
+       # test needs a running copytool
+       copytool_setup
+
+       mkdir -p $DIR/$tdir
+       local f=$DIR/$tdir/$tfile
+       local fid=$(make_custom_file_for_progress $f 103 1048576)
+
+       cdt_disable
+       # to have a short test
+       local old_to=$(get_hsm_param active_request_timeout)
+       set_hsm_param active_request_timeout 20
+       # to be sure the cdt will wake up frequently so
+       # it will be able to cancel the "old" request
+       local old_loop=$(get_hsm_param loop_period)
+       set_hsm_param loop_period 2
+       cdt_enable
+
+       # clear locks to avoid extra delay caused by flush/cancel
+       # and thus prevent early copytool death to timeout.
+       cancel_lru_locks osc
+
+       $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
+       wait_request_state $fid ARCHIVE STARTED
+       rm -f $f
+
+       # wait but less than active_request_timeout+grace_delay
+       sleep 25
+       wait_request_state $fid ARCHIVE CANCELED
+
+       set_hsm_param active_request_timeout $old_to
+       set_hsm_param loop_period $old_loop
+
+       copytool_cleanup
+}
+run_test 252 "Timeout'ed running archive of a removed file should be canceled"
+
 test_300() {
        # the only way to test ondisk conf is to restart MDS ...
        echo "Stop coordinator and remove coordinator state at mount"