Whamcloud - gitweb
LU-11075 ldlm: correct logic in ldlm_prepare_lru_list() 60/32660/2
authorJohn L. Hammond <john.hammond@intel.com>
Thu, 7 Jun 2018 17:08:42 +0000 (12:08 -0500)
committerOleg Drokin <green@whamcloud.com>
Sat, 1 Sep 2018 03:29:26 +0000 (03:29 +0000)
In ldlm_prepare_lru_list() fix an (x != a || x != b) type error and
correct a use after free.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I4e34e531260295805c4461e7d8d98675400f1148
Reviewed-on: https://review.whamcloud.com/32660
Tested-by: Jenkins
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ldlm/ldlm_request.c

index 6ce7226..fcb2b4a 100644 (file)
@@ -1886,7 +1886,7 @@ static int ldlm_prepare_lru_list(struct ldlm_namespace *ns,
                        /* No locks which got blocking requests. */
                        LASSERT(!ldlm_is_bl_ast(lock));
 
-                       if (!ldlm_is_canceling(lock) ||
+                       if (!ldlm_is_canceling(lock) &&
                            !ldlm_is_converting(lock))
                                break;
 
@@ -1927,7 +1927,6 @@ static int ldlm_prepare_lru_list(struct ldlm_namespace *ns,
 
                if (result == LDLM_POLICY_SKIP_LOCK) {
                        lu_ref_del(&lock->l_reference, __func__, current);
-                       LDLM_LOCK_RELEASE(lock);
                        if (no_wait) {
                                spin_lock(&ns->ns_lock);
                                if (!list_empty(&lock->l_lru) &&
@@ -1935,6 +1934,8 @@ static int ldlm_prepare_lru_list(struct ldlm_namespace *ns,
                                        ns->ns_last_pos = &lock->l_lru;
                                spin_unlock(&ns->ns_lock);
                        }
+
+                       LDLM_LOCK_RELEASE(lock);
                        continue;
                }