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;
/* 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)
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));
* 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);
}
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)
/* 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) {