diff mbox series

[10/19] lustre: ptlrpc: fix timeout after spurious wakeup

Message ID 1638142074-5945-11-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series lustre: update to OpenSFS tree Nov 28, 2021 | expand

Commit Message

James Simmons Nov. 28, 2021, 11:27 p.m. UTC
From: Alex Zhuravlev <bzzz@whamcloud.com>

so that final timeout don't exceed requested one

WC-bug-id: https://jira.whamcloud.com/browse/LU-15086
Lustre-commit: b8383035406a4b7be ("LU-15086 ptlrpc: fix timeout after spurious wakeup")
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/45308
Reviewed-by: Andriy Skulysh <andriy.skulysh@hpe.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/ptlrpc/ptlrpcd.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/fs/lustre/ptlrpc/ptlrpcd.c b/fs/lustre/ptlrpc/ptlrpcd.c
index 9cd9d39..23fb52d 100644
--- a/fs/lustre/ptlrpc/ptlrpcd.c
+++ b/fs/lustre/ptlrpc/ptlrpcd.c
@@ -438,7 +438,7 @@  static int ptlrpcd(void *arg)
 		DEFINE_WAIT_FUNC(wait, woken_wake_function);
 		time64_t timeout;
 
-		timeout = ptlrpc_set_next_timeout(set);
+		timeout = ptlrpc_set_next_timeout(set) * HZ;
 
 		lu_context_enter(&env.le_ctx);
 		lu_context_enter(env.le_ses);
@@ -447,12 +447,15 @@  static int ptlrpcd(void *arg)
 		while (!ptlrpcd_check(&env, pc)) {
 			int ret;
 
-			if (timeout == 0)
+			if (timeout == 0) {
 				ret = wait_woken(&wait, TASK_IDLE,
 						 MAX_SCHEDULE_TIMEOUT);
-			else
+			} else {
 				ret = wait_woken(&wait, TASK_IDLE,
-						 HZ * timeout);
+						 timeout);
+				if (ret > 0)
+					timeout = ret;
+			}
 			if (ret != 0)
 				continue;
 			/* Timed out */