Whamcloud - gitweb
More debugging.
authoradilger <adilger>
Mon, 7 Oct 2002 22:10:38 +0000 (22:10 +0000)
committeradilger <adilger>
Mon, 7 Oct 2002 22:10:38 +0000 (22:10 +0000)
lustre/ldlm/ldlm_lock.c
lustre/ldlm/ldlm_lockd.c

index 93d67f6..d48fca5 100644 (file)
@@ -309,12 +309,17 @@ struct ldlm_lock *ldlm_handle2lock(struct lustre_handle *handle)
         struct ldlm_lock *lock = NULL, *retval = NULL;
         ENTRY;
 
-        if (!handle || !handle->addr)
+        if (!handle || !handle->addr) {
+                CERROR("bogus handle %p->"LPX64"\n", handle,
+                       handle ? handle->addr : -1);
                 RETURN(NULL);
+        }
 
         lock = (struct ldlm_lock *)(unsigned long)(handle->addr);
-        if (!kmem_cache_validate(ldlm_lock_slab, (void *)lock))
+        if (!kmem_cache_validate(ldlm_lock_slab, (void *)lock)) {
+                CERROR("bogus lock %p\n", lock);
                 RETURN(NULL);
+        }
 
         if (!lock->l_resource) {
                 CERROR("trying to lock bogus resource: lock %p\n", lock);
@@ -327,13 +332,21 @@ struct ldlm_lock *ldlm_handle2lock(struct lustre_handle *handle)
                 RETURN(NULL);
         }
         l_lock(&lock->l_resource->lr_namespace->ns_lock);
-        if (lock->l_random != handle->cookie)
+        if (lock->l_random != handle->cookie) {
+                CERROR("bogus cookie: lock "LPX64", handle "LPX64"\n",
+                       lock->l_random, handle->cookie);
                 GOTO(out, NULL);
+        }
 
-        if (lock->l_flags & LDLM_FL_DESTROYED)
+        if (lock->l_flags & LDLM_FL_DESTROYED) {
+                CERROR("lock already destroyed: lock %p\n", lock);
+                LDLM_DEBUG(lock, "ldlm_handle2lock(%p)", lock);
                 GOTO(out, NULL);
+        }
 
         retval = LDLM_LOCK_GET(lock);
+        if (!retval)
+                CERROR("lock disappeared below us!!! %p\n", lock);
         EXIT;
  out:
         l_unlock(&lock->l_resource->lr_namespace->ns_lock);
index 7df5ce7..0c67410 100644 (file)
@@ -341,24 +341,29 @@ int ldlm_handle_cancel(struct ptlrpc_request *req)
         int rc;
         ENTRY;
 
+        CERROR("pt 1\n");
         rc = lustre_pack_msg(0, NULL, NULL, &req->rq_replen, &req->rq_repmsg);
         if (rc) {
                 CERROR("out of memory\n");
                 RETURN(-ENOMEM);
         }
+        CERROR("pt 2\n");
         dlm_req = lustre_msg_buf(req->rq_reqmsg, 0);
         if (!dlm_req) {
                 CERROR("bad request buffer for cancel\n");
                 RETURN(-EINVAL);
         }
 
+        CERROR("pt 3\n");
         lock = ldlm_handle2lock(&dlm_req->lock_handle1);
         if (!lock) {
+                CERROR("bad lock handle\n");
                 LDLM_DEBUG_NOLOCK("server-side cancel handler stale lock (lock "
                                   "%p)", (void *)(unsigned long)
                                   dlm_req->lock_handle1.addr);
                 req->rq_status = ESTALE;
         } else {
+                CERROR("pt 4\n");
                 LDLM_DEBUG(lock, "server-side cancel handler START");
                 ldlm_lock_cancel(lock);
                 if (ldlm_del_waiting_lock(lock))
@@ -370,6 +375,7 @@ int ldlm_handle_cancel(struct ptlrpc_request *req)
                 LBUG();
 
         if (lock) {
+                CERROR("pt 5\n");
                 ldlm_reprocess_all(lock->l_resource);
                 LDLM_DEBUG(lock, "server-side cancel handler END");
                 LDLM_LOCK_PUT(lock);