+
+ if (work_list && lock->l_completion_ast != NULL)
+ ldlm_add_ast_work_item(lock, NULL, work_list);
+
+ /* We should not add locks to granted list in the following cases:
+ * - this is an UNLOCK but not a real lock;
+ * - this is a TEST lock;
+ * - this is a F_CANCELLK lock (async flock has req_mode == 0)
+ * - this is a deadlock (flock cannot be granted) */
+ if (lock->l_req_mode == 0 ||
+ lock->l_req_mode == LCK_NL ||
+ ldlm_is_test_lock(lock) ||
+ ldlm_is_flock_deadlock(lock))
+ RETURN_EXIT;
+