ptlrpc_req_finished(req);
+ /* If we cancelled the lock, we need to restart ldlm_reprocess_queue */
+ if (!rc && instant_cancel)
+ rc = -ERESTART;
+
RETURN(rc);
}
struct ptlrpc_request *req;
struct timeval granted_time;
long total_enqueue_wait;
- int rc = 0, size[2] = {sizeof(*body)}, buffers = 1;
+ int rc = 0, size[2] = {sizeof(*body)}, buffers = 1, instant_cancel = 0;
ENTRY;
LASSERT(lock != NULL);
ldlm_handle_enqueue will call ldlm_lock_cancel() still, that
would not only cancel the loc, but will also remove it from
waiting list */
- if (lock->l_flags & LDLM_FL_CANCEL_ON_BLOCK)
+ if (lock->l_flags & LDLM_FL_CANCEL_ON_BLOCK) {
ldlm_lock_cancel(lock);
- else
+ instant_cancel = 1;
+ } else {
ldlm_add_waiting_lock(lock); /* start the lock-timeout
clock */
+ }
}
l_unlock(&lock->l_resource->lr_namespace->ns_lock);
ptlrpc_req_finished(req);
+ /* If we cancelled the lock, we need to restart ldlm_reprocess_queue */
+ if (!rc && instant_cancel)
+ rc = -ERESTART;
+
RETURN(rc);
}