- struct list_head *head;
-
- /* last lock in policy group */
- tmp = &list_entry(lock->l_sl_policy.prev,
- struct ldlm_lock,
- l_sl_policy)->l_res_link;
-
- /* locks with bits overlapped are conflicting locks */
- if (lock->l_policy_data.l_inodebits.bits & req_bits) {
- /* conflicting policy */
- if (!work_list)
- RETURN(0);
-
- compat = 0;
-
- /* add locks of the policy group to
- * @work_list as blocking locks for
- * @req */
+ cfs_list_t *head;
+
+ /* Advance loop cursor to last lock in policy group. */
+ tmp = &cfs_list_entry(lock->l_sl_policy.prev,
+ struct ldlm_lock,
+ l_sl_policy)->l_res_link;
+
+ /* Locks with overlapping bits conflict. */
+ if (lock->l_policy_data.l_inodebits.bits & req_bits) {
+ /* COS lock mode has a special compatibility
+ * requirement: it is only compatible with
+ * locks from the same client. */
+ if (lock->l_req_mode == LCK_COS &&
+ lock->l_client_cookie == req->l_client_cookie)
+ goto not_conflicting;
+ /* Found a conflicting policy group. */
+ if (!work_list)
+ RETURN(0);
+
+ compat = 0;
+
+ /* Add locks of the policy group to @work_list
+ * as blocking locks for @req */