Whamcloud - gitweb
LU-9019 llite: fix timeout to not be zero 92/35992/2
authorAndreas Dilger <adilger@whamcloud.com>
Thu, 29 Aug 2019 14:24:10 +0000 (08:24 -0600)
committerOleg Drokin <green@whamcloud.com>
Sat, 7 Sep 2019 01:49:18 +0000 (01:49 +0000)
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 <adilger@whamcloud.com>
Change-Id: I33efbfc2d6c0a9c4ae6404c1974c7593a72540e5
Reviewed-on: https://review.whamcloud.com/35992
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/llite_lib.c
lustre/mgc/mgc_request.c

index f72c8b6..68d6d17 100644 (file)
@@ -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);
                }
        }
 
index cc63705..6617160 100644 (file)
@@ -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);