Whamcloud - gitweb
LU-10269 ldlm: allow trybits in waiting queue 43/30343/6
authorMikhal Pershin <mike.pershin@intel.com>
Sat, 2 Dec 2017 08:42:11 +0000 (11:42 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 4 Jan 2018 02:48:24 +0000 (02:48 +0000)
Lock trybits can be kept while lock is waiting and each new
lock filters trybits of locks in the waiting queue. When lock
if granted finally remaining trybits are added to the granted
bits. Therefore trybits can be granted for blocking lock if
no other locks take these bits while lock is waiting.

Test-Parameters: mdscount=1 mdtcount=1 testlist=racer,racer,racer,racer
Signed-off-by: Mikhal Pershin <mike.pershin@intel.com>
Change-Id: I775f776f4cf8b581e32e4a1585e862e1764b5bed
Reviewed-on: https://review.whamcloud.com/30343
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ldlm/ldlm_inodebits.c

index 85c4e31..0c51ab7 100644 (file)
@@ -133,17 +133,22 @@ ldlm_inodebits_compat_queue(struct list_head *queue, struct ldlm_lock *req,
                                          struct ldlm_lock,
                                          l_sl_policy)->l_res_link;
 
-                       /* no locks with trybits in either queues */
-                       LASSERT(lock->l_policy_data.l_inodebits.try_bits == 0);
-
                        /* New lock's try_bits are filtered out by ibits
                         * of all locks in both granted and waiting queues.
                         */
-                       *try_bits &= ~lock->l_policy_data.l_inodebits.bits;
+                       *try_bits &= ~(lock->l_policy_data.l_inodebits.bits |
+                               lock->l_policy_data.l_inodebits.try_bits);
 
                        if ((req_bits | *try_bits) == 0)
                                RETURN(0);
 
+                       /* The new lock ibits is more preferable than try_bits
+                        * of waiting locks so drop conflicting try_bits in
+                        * the waiting queue.
+                        * Notice that try_bits of granted locks must be zero.
+                        */
+                       lock->l_policy_data.l_inodebits.try_bits &= ~req_bits;
+
                        /* Locks with overlapping bits conflict. */
                        if (lock->l_policy_data.l_inodebits.bits & req_bits) {
                                /* COS lock mode has a special compatibility
@@ -155,12 +160,6 @@ ldlm_inodebits_compat_queue(struct list_head *queue, struct ldlm_lock *req,
                                    lock->l_client_cookie == req->l_client_cookie)
                                        goto not_conflicting;
 
-                               /* The conflicting lock will keep only mandatory
-                                * ibits and zero trybits in waiting queue.
-                                * All actual trybits are cleared.
-                                */
-                               *try_bits = 0;
-
                                /* Found a conflicting policy group. */
                                if (!work_list)
                                        RETURN(0);