Whamcloud - gitweb
b=9294
authoralex <alex>
Tue, 13 Sep 2005 08:53:04 +0000 (08:53 +0000)
committeralex <alex>
Tue, 13 Sep 2005 08:53:04 +0000 (08:53 +0000)
 - debug message to make sure we interpret LASSERT() right

lustre/ldlm/ldlm_extent.c

index 25f4ae7..3fdee74 100644 (file)
@@ -160,7 +160,7 @@ static void ldlm_extent_policy(struct ldlm_resource *res,
 static int
 ldlm_extent_compat_queue(struct list_head *queue, struct ldlm_lock *req,
                          int *flags, struct list_head *work_list,
-                         struct list_head **insertp)
+                         struct list_head **insertp, int count)
 {
         struct list_head *tmp;
         struct ldlm_lock *lock;
@@ -273,7 +273,13 @@ ldlm_extent_compat_queue(struct list_head *queue, struct ldlm_lock *req,
 
                 /* Ensure we scan entire list if insertp is requested so that
                  * the new request will be appended to the end of the list. */
-                LASSERT((insertp == NULL) || (tmp == queue));
+                if (!((insertp == NULL) || (tmp == queue))) {
+                        unlock_res(req->l_resource);
+                        ldlm_lock_dump(D_ERROR, req, 0);
+                }
+                LASSERTF((insertp == NULL) || (tmp == queue), "insertp = %p, "
+                         "tmp = %p, queue = %p, count = %d\n", insertp, tmp,
+                         queue, count);
         }
 
         if (insertp)
@@ -297,7 +303,7 @@ int ldlm_process_extent_lock(struct ldlm_lock *lock, int *flags, int first_enq,
         struct ldlm_resource *res = lock->l_resource;
         struct list_head rpc_list = LIST_HEAD_INIT(rpc_list);
         struct list_head *insertp = NULL;
-        int rc, rc2;
+        int rc, rc2, count = 0;
         ENTRY;
 
         LASSERT(list_empty(&res->lr_converting));
@@ -310,10 +316,10 @@ int ldlm_process_extent_lock(struct ldlm_lock *lock, int *flags, int first_enq,
                  * ever changes we want to find out. */
                 LASSERT(*flags == 0);
                 rc = ldlm_extent_compat_queue(&res->lr_granted, lock,
-                                              flags, NULL, NULL);
+                                              flags, NULL, NULL, -1);
                 if (rc == 1) {
                         rc = ldlm_extent_compat_queue(&res->lr_waiting, lock,
-                                                      flags, NULL, NULL);
+                                                      flags, NULL, NULL, -2);
                 }
                 if (rc == 0)
                         RETURN(LDLM_ITER_STOP);
@@ -325,8 +331,9 @@ int ldlm_process_extent_lock(struct ldlm_lock *lock, int *flags, int first_enq,
         }
 
  restart:
+        count++;
         rc = ldlm_extent_compat_queue(&res->lr_granted, lock, flags, &rpc_list,
-                                      NULL);
+                                      NULL, count);
         if (rc < 0)
                 GOTO(destroylock, rc);
         if (rc == 2)
@@ -335,7 +342,7 @@ int ldlm_process_extent_lock(struct ldlm_lock *lock, int *flags, int first_enq,
         /* Traverse the waiting list in case there are other conflicting
          * lock requests ahead of us in the queue and send blocking ASTs */
         rc2 = ldlm_extent_compat_queue(&res->lr_waiting, lock, flags, &rpc_list,
-                                       &insertp);
+                                       &insertp, count);
         if (rc2 < 0)
                 GOTO(destroylock, rc);
         if (rc + rc2 == 2) {