From: Quentin Bouget Date: Tue, 29 Nov 2016 15:39:26 +0000 (+0100) Subject: LU-8879 tests: speed up copytool_cleanup() in sanity-hsm X-Git-Tag: 2.9.57~7 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=a729f66cf1917b80975937568552625f1cc45271 LU-8879 tests: speed up copytool_cleanup() in sanity-hsm 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 Change-Id: Ia460df59a724caaa194565dd7af402c8c617f40e Reviewed-on: https://review.whamcloud.com/24025 Reviewed-by: Henri Doreau Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Jean-Baptiste Riaux Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdt/mdt_coordinator.c b/lustre/mdt/mdt_coordinator.c index 10da26b..804b8e2 100644 --- a/lustre/mdt/mdt_coordinator.c +++ b/lustre/mdt/mdt_coordinator.c @@ -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) || diff --git a/lustre/tests/sanity-hsm.sh b/lustre/tests/sanity-hsm.sh index 359f781..c1d7490 100755 --- a/lustre/tests/sanity-hsm.sh +++ b/lustre/tests/sanity-hsm.sh @@ -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