Whamcloud - gitweb
LU-10467 ldlm: convert l_wait_event in __ldlm_namespace_free 89/35989/9
authorMr NeilBrown <neilb@suse.com>
Wed, 28 Aug 2019 23:35:23 +0000 (09:35 +1000)
committerOleg Drokin <green@whamcloud.com>
Fri, 6 Dec 2019 00:59:03 +0000 (00:59 +0000)
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 <neilb@suse.com>
Change-Id: I1ac7ff5daa80581010cd913f01650c07ac40c151
Reviewed-on: https://review.whamcloud.com/35989
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Shaun Tancheff <stancheff@cray.com>
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ldlm/ldlm_resource.c

index baf935e..4543c98 100644 (file)
@@ -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),