From fb291dbf72ecd32847f1499776a441126f28e9bf Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Sat, 18 Jan 2020 09:46:59 -0500 Subject: [PATCH] LU-10467 ptlrpc: convert use of l_wait_event_exclusive_head() Only one place uses l_wait_event_exclusive_head(). It uses an on_timeout function that returns non-zero, so the wait aborts after timeout. Change this to wait_event_idle_exclusive_lifo_timeout(), and if it times out, perform the same action as the on_timeout handler - a simple assignment. Signed-off-by: Mr NeilBrown Change-Id: I11bee6aa1eceb6564fb72e41528f2f6a80b0d207 Reviewed-on: https://review.whamcloud.com/35986 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Petros Koutoupis Reviewed-by: Shaun Tancheff Reviewed-by: Oleg Drokin --- lustre/ptlrpc/service.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 8962690..fefcb29 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -2554,14 +2554,6 @@ static void ptlrpc_check_rqbd_pool(struct ptlrpc_service_part *svcpt) } } -static int ptlrpc_retry_rqbds(void *arg) -{ - struct ptlrpc_service_part *svcpt = (struct ptlrpc_service_part *)arg; - - svcpt->scp_rqbd_timeout = 0; - return -ETIMEDOUT; -} - static inline int ptlrpc_threads_enough(struct ptlrpc_service_part *svcpt) { return svcpt->scp_nreqs_active < @@ -2705,20 +2697,28 @@ static __attribute__((__noinline__)) int ptlrpc_wait_event(struct ptlrpc_service_part *svcpt, struct ptlrpc_thread *thread) { - /* Don't exit while there are replies to be handled */ - struct l_wait_info lwi = LWI_TIMEOUT(svcpt->scp_rqbd_timeout, - ptlrpc_retry_rqbds, svcpt); - ptlrpc_watchdog_disable(&thread->t_watchdog); cond_resched(); - l_wait_event_exclusive_head(svcpt->scp_waitq, - ptlrpc_thread_stopping(thread) || - ptlrpc_server_request_incoming(svcpt) || - ptlrpc_server_request_pending(svcpt, false) || - ptlrpc_rqbd_pending(svcpt) || - ptlrpc_at_check(svcpt), &lwi); + if (svcpt->scp_rqbd_timeout == 0) + /* Don't exit while there are replies to be handled */ + wait_event_idle_exclusive_lifo( + svcpt->scp_waitq, + ptlrpc_thread_stopping(thread) || + ptlrpc_server_request_incoming(svcpt) || + ptlrpc_server_request_pending(svcpt, false) || + ptlrpc_rqbd_pending(svcpt) || + ptlrpc_at_check(svcpt)); + else if (wait_event_idle_exclusive_lifo_timeout( + svcpt->scp_waitq, + ptlrpc_thread_stopping(thread) || + ptlrpc_server_request_incoming(svcpt) || + ptlrpc_server_request_pending(svcpt, false) || + ptlrpc_rqbd_pending(svcpt) || + ptlrpc_at_check(svcpt), + svcpt->scp_rqbd_timeout) == 0) + svcpt->scp_rqbd_timeout = 0; if (ptlrpc_thread_stopping(thread)) return -EINTR; -- 1.8.3.1