From 6fbfb01be3c45c60c418ca37280d2378f91bc565 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Thu, 29 Aug 2019 08:24:10 -0600 Subject: [PATCH] LU-9019 llite: fix timeout to not be zero The timeout in ll_kill_super() is intended to be 1/8 of a second, while it loops waiting on other threads to finish. However, this was incorrectly calculated to always be 0 (infinite wait) due to integer division. Instead, convert seconds to jiffies before division. Fixes: 0c2cc920370e ("LU-9019 libcfs: avoid using HZ and msecs_to_jiffies()") Signed-off-by: Andreas Dilger Change-Id: I33efbfc2d6c0a9c4ae6404c1974c7593a72540e5 Reviewed-on: https://review.whamcloud.com/35992 Reviewed-by: James Simmons Reviewed-by: Patrick Farrell Tested-by: jenkins Reviewed-by: Neil Brown Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/llite/llite_lib.c | 2 +- lustre/mgc/mgc_request.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index f72c8b6..68d6d17 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -809,7 +809,7 @@ void ll_kill_super(struct super_block *sb) /* wait running statahead threads to quit */ while (atomic_read(&sbi->ll_sa_running) > 0) { set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(cfs_time_seconds(1 >> 3)); + schedule_timeout(cfs_time_seconds(1) >> 3); } } diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index cc63705..6617160 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -641,10 +641,9 @@ static int mgc_requeue_thread(void *data) /* Always wait a few seconds to allow the server who caused the lock revocation to finish its setup, plus some random so everyone doesn't try to reconnect at once. */ - to = cfs_time_seconds(MGC_TIMEOUT_MIN_SECONDS); + to = cfs_time_seconds(MGC_TIMEOUT_MIN_SECONDS * 100 + rand); /* rand is centi-seconds */ - to += cfs_time_seconds(rand) / 100; - lwi = LWI_TIMEOUT(to, NULL, NULL); + lwi = LWI_TIMEOUT(to / 100, NULL, NULL); l_wait_event(rq_waitq, rq_state & (RQ_STOP | RQ_PRECLEANUP), &lwi); -- 1.8.3.1