Whamcloud - gitweb
LU-17871 ldlm: FLOCK ownlocks may be not set 84/55184/7
authorAndriy Skulysh <andriy.skulysh@hpe.com>
Wed, 3 Apr 2024 10:34:32 +0000 (13:34 +0300)
committerOleg Drokin <green@whamcloud.com>
Wed, 5 Jun 2024 04:53:20 +0000 (04:53 +0000)
Conflict checking loop should continue until ownlocks is set.
Ownlocks variable is essential for lock merges.

Change-Id: Ied526581dd7d4f100c95f2fe582d117a87a8a584
Fixes: b07a57027e (LU-15402 ldlm: speedup RD flock enqueue)
HPE-bug-id: LUS-12243
Signed-off-by: Andriy Skulysh <andriy.skulysh@hpe.com>
Reviewed-by: Vitaly Fertman <vitaly.fertman@hpe.com>
Reviewed-by: Alexander Boyko <alexander.boyko@hpe.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55184
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Sergey Cheremencev <scherementsev@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ldlm/ldlm_flock.c

index 659dd4a..14a182b 100644 (file)
@@ -377,6 +377,7 @@ reprocess:
 #ifdef HAVE_SERVER_SUPPORT
        else {
                int reprocess_failed = 0;
+               int pr_matched = 0;
 
                lockmode_verify(mode);
 
@@ -385,8 +386,11 @@ reprocess:
                 */
                list_for_each_entry(lock, &res->lr_granted, l_res_link) {
                        if (ldlm_same_flock_owner(lock, req)) {
-                               if (!ownlocks)
+                               if (!ownlocks) {
                                        ownlocks = lock;
+                                       if (pr_matched)
+                                               break;
+                               }
                                continue;
                        }
 
@@ -397,7 +401,10 @@ reprocess:
                            lock->l_policy_data.l_flock.end >=
                                req->l_policy_data.l_flock.end) {
                                /* there can't be granted WR lock */
-                               break;
+                               if (ownlocks)
+                                       break;
+                               pr_matched = 1;
+                               continue;
                        }
                        /* locks are compatible, overlap doesn't matter */
                        if (lockmode_compat(lock->l_granted_mode, mode))