Whamcloud - gitweb
LU-17871 ldlm: FLOCK ownlocks may be not set
authorAndriy Skulysh <andriy.skulysh@hpe.com>
Wed, 3 Apr 2024 10:34:32 +0000 (13:34 +0300)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 7 Jun 2024 07:25:34 +0000 (07:25 +0000)
Conflict checking loop should continue until ownlocks is set.
Ownlocks variable is essential for lock merges.

Lustre-change: https://review.whamcloud.com/55184
Lustre-commit: ede8d928d6c47551371512c80dfa4f159260e7e2

Fixes: b07a57027e (LU-15402 ldlm: speedup RD flock enqueue)
Signed-off-by: Sergey Cheremencev <scherementsev@ddn.com>
Signed-off-by: Andriy Skulysh <andriy.skulysh@hpe.com>
Change-Id: Ied526581dd7d4f100c95f2fe582d117a87a8a584
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/55246
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/ldlm/ldlm_flock.c

index 2617e65..2137687 100644 (file)
@@ -343,6 +343,8 @@ reprocess:
 #ifdef HAVE_SERVER_SUPPORT
        else {
                int reprocess_failed = 0;
+               int pr_matched = 0;
+
                lockmode_verify(mode);
 
                /* This loop determines if there are existing locks
@@ -353,8 +355,11 @@ reprocess:
                                          l_res_link);
 
                        if (ldlm_same_flock_owner(lock, req)) {
-                               if (!ownlocks)
+                               if (!ownlocks) {
                                        ownlocks = tmp;
+                                       if (pr_matched)
+                                               break;
+                               }
                                continue;
                        }
 
@@ -365,7 +370,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))