From b8383035406a4b7bee2e6d8674eaef480b3e3b35 Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Wed, 20 Oct 2021 14:10:57 +0300 Subject: [PATCH] LU-15086 ptlrpc: fix timeout after spurious wakeup so that final timeout don't exceed requested one Signed-off-by: Alex Zhuravlev Change-Id: Iff5e08c589cbbc3c483915002f3f9df7a6f2678a Reviewed-on: https://review.whamcloud.com/45308 Reviewed-by: Andriy Skulysh Reviewed-by: James Simmons Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/ptlrpc/ptlrpcd.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lustre/ptlrpc/ptlrpcd.c b/lustre/ptlrpc/ptlrpcd.c index 4c9b577..1f540af 100644 --- a/lustre/ptlrpc/ptlrpcd.c +++ b/lustre/ptlrpc/ptlrpcd.c @@ -480,7 +480,7 @@ static int ptlrpcd(void *arg) DEFINE_WAIT_FUNC(wait, woken_wake_function); time64_t timeout; - timeout = ptlrpc_set_next_timeout(set); + timeout = cfs_time_seconds(ptlrpc_set_next_timeout(set)); lu_context_enter(&env.le_ctx); lu_context_enter(env.le_ses); @@ -492,9 +492,11 @@ static int ptlrpcd(void *arg) if (timeout == 0) ret = wait_woken(&wait, TASK_IDLE, MAX_SCHEDULE_TIMEOUT); - else - ret = wait_woken(&wait, TASK_IDLE, - cfs_time_seconds(timeout)); + else { + ret = wait_woken(&wait, TASK_IDLE, timeout); + if (ret > 0) + timeout = ret; + } if (ret != 0) continue; /* Timed out */ -- 1.8.3.1