From: Mr NeilBrown Date: Wed, 28 Aug 2019 23:35:23 +0000 (+1000) Subject: LU-10467 ldlm: convert l_wait_event in __ldlm_namespace_free X-Git-Tag: 2.13.51~176 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=6a576848dfed0090602da6975dcbfa0a87adc3be LU-10467 ldlm: convert l_wait_event in __ldlm_namespace_free The l_wait_event call in __ldlm_namespace_free() can do one of two things depending on which LWI_* setup call is in effect. If 'force', it ignores signals and times out after 1/4 second. If '!force', it has no timeout but allows fatal signals. So change it to two separate calls: wait_event_idle_timeout() or l_wait_event_abortable(). Signed-off-by: Mr NeilBrown Change-Id: I1ac7ff5daa80581010cd913f01650c07ac40c151 Reviewed-on: https://review.whamcloud.com/35989 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Shaun Tancheff Reviewed-by: Petros Koutoupis Reviewed-by: Oleg Drokin --- diff --git a/lustre/ldlm/ldlm_resource.c b/lustre/ldlm/ldlm_resource.c index baf935e..4543c98 100644 --- a/lustre/ldlm/ldlm_resource.c +++ b/lustre/ldlm/ldlm_resource.c @@ -1187,22 +1187,24 @@ static int __ldlm_namespace_free(struct ldlm_namespace *ns, int force) ldlm_namespace_cleanup(ns, force ? LDLM_FL_LOCAL_ONLY : 0); if (atomic_read(&ns->ns_bref) > 0) { - struct l_wait_info lwi = LWI_INTR(LWI_ON_SIGNAL_NOOP, NULL); int rc; CDEBUG(D_DLMTRACE, "dlm namespace %s free waiting on refcount %d\n", ldlm_ns_name(ns), atomic_read(&ns->ns_bref)); force_wait: if (force) - lwi = LWI_TIMEOUT(cfs_time_seconds(1) / 4, - NULL, NULL); - - rc = l_wait_event(ns->ns_waitq, - atomic_read(&ns->ns_bref) == 0, &lwi); + rc = wait_event_idle_timeout( + ns->ns_waitq, + atomic_read(&ns->ns_bref) == 0, + cfs_time_seconds(1) / 4); + else + rc = l_wait_event_abortable( + ns->ns_waitq, atomic_read(&ns->ns_bref) == 0); /* Forced cleanups should be able to reclaim all references, * so it's safe to wait forever... we can't leak locks... */ - if (force && rc == -ETIMEDOUT) { + if (force && rc == 0) { + rc = -ETIMEDOUT; LCONSOLE_ERROR("Forced cleanup waiting for %s " "namespace with %d resources in use, " "(rc=%d)\n", ldlm_ns_name(ns),