Whamcloud - gitweb
LU-13692 ldlm: Ensure we reprocess the resource on ast error 12/40412/5
authorOleg Drokin <green@whamcloud.com>
Fri, 7 Aug 2020 07:38:51 +0000 (03:38 -0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 3 Nov 2020 20:09:11 +0000 (20:09 +0000)
When we are trying to grant a lock and met an AST error, rerunning
the policy is pointless since it cannot grant a potentially now eligible
lock and our lock is already in all the queues, just be like all the other
handlers for ERESTART return and run a full resource reprocess instead.

Lustre-change: https://review.whamcloud.com/#/c/39598/
Lustre-commit: 24e3b5395bc61333a32b1e9725a0d7273925ef05

Change-Id: I3edb37bf084b2e26ba03cf2079d3358779c84b6e
Signed-off-by: Oleg Drokin <green@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/40412
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/ldlm/ldlm_lock.c

index 64d331f..42eccaf 100644 (file)
@@ -1732,14 +1732,10 @@ static enum ldlm_error ldlm_lock_enqueue_helper(struct ldlm_lock *lock,
        ENTRY;
 
        policy = ldlm_get_processing_policy(res);
-restart:
        policy(lock, flags, LDLM_PROCESS_ENQUEUE, &rc, &rpc_list);
        if (rc == ELDLM_OK && lock->l_granted_mode != lock->l_req_mode &&
-           res->lr_type != LDLM_FLOCK) {
+           res->lr_type != LDLM_FLOCK)
                rc = ldlm_handle_conflict_lock(lock, flags, &rpc_list);
-               if (rc == -ERESTART)
-                       GOTO(restart, rc);
-       }
 
        if (!list_empty(&rpc_list))
                ldlm_discard_bl_list(&rpc_list);
@@ -2012,6 +2008,9 @@ int ldlm_handle_conflict_lock(struct ldlm_lock *lock, __u64 *flags,
            !ns_is_client(ldlm_res_to_ns(res)))
                class_fail_export(lock->l_export);
 
+       if (rc == -ERESTART)
+               ldlm_reprocess_all(res, NULL);
+
        lock_res(res);
        if (rc == -ERESTART) {
                /* 15715: The lock was granted and destroyed after
@@ -2031,10 +2030,8 @@ int ldlm_handle_conflict_lock(struct ldlm_lock *lock, __u64 *flags,
                         * freed. Then we will fail at
                         * ldlm_extent_add_lock() */
                        *flags &= ~LDLM_FL_BLOCKED_MASK;
-                       RETURN(0);
                }
 
-               RETURN(rc);
        }
        *flags |= LDLM_FL_BLOCK_GRANTED;