Whamcloud - gitweb
LU-8879 tests: speed up copytool_cleanup() in sanity-hsm 25/24025/7
authorQuentin Bouget <quentin.bouget@cea.fr>
Tue, 29 Nov 2016 15:39:26 +0000 (16:39 +0100)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 5 May 2017 00:43:31 +0000 (00:43 +0000)
This patch implements the following improvements:

 - The coordinator now wakes up when hsm_control is set to 'shutdown'

 - The wait_copytools() function in sanity-hsm uses a polling
   mechanism to detect when all running copytools are killed.
   It used to sleep before the first check, even though that check
   would pass most of the time. This has been fixed.

 - wait_copytools() used to sleep for 2s between its checks. It now
   sleeps for 0.1s, 0.2s, 0.4s, 0.8s, 1.6s, 3.2s, 3.2s, 3.2s, ...
   until it times out.

Considering how often the wait_copytools() function is called in
sanity-hsm, this patch should represent a noticeable speed-up.

Test-Parameters: trivial testlist=sanity-hsm
Signed-off-by: Quentin Bouget <quentin.bouget@cea.fr>
Change-Id: Ia460df59a724caaa194565dd7af402c8c617f40e
Reviewed-on: https://review.whamcloud.com/24025
Reviewed-by: Henri Doreau <henri.doreau@cea.fr>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Jean-Baptiste Riaux <riaux.jb@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdt/mdt_coordinator.c
lustre/tests/sanity-hsm.sh

index 10da26b..804b8e2 100644 (file)
@@ -1930,6 +1930,7 @@ mdt_hsm_cdt_control_seq_write(struct file *file, const char __user *buffer,
                        rc = -EALREADY;
                } else {
                        cdt->cdt_state = CDT_STOPPING;
+                       mdt_hsm_cdt_wakeup(mdt);
                }
        } else if (strcmp(kernbuf, CDT_DISABLE_CMD) == 0) {
                if ((cdt->cdt_state == CDT_STOPPING) ||
index 359f781..c1d7490 100755 (executable)
@@ -170,15 +170,18 @@ wait_copytools() {
        local wait_timeout=200
        local wait_start=$SECONDS
        local wait_end=$((wait_start + wait_timeout))
+       local sleep_time=100000 # 0.1 second
 
        while ((SECONDS < wait_end)); do
-               sleep 2
                if ! search_copytools $hosts; then
                        echo "copytools stopped in $((SECONDS - wait_start))s"
                        return 0
                fi
 
                echo "copytools still running on $hosts"
+               usleep $sleep_time
+               [ $sleep_time -lt 32000000 ] && # 3.2 seconds
+                       sleep_time=$(bc <<< "$sleep_time * 2")
        done
 
        # try to dump Copytool's stack