Whamcloud - gitweb
smash the HEAD with the contents of b_cmd. HEAD_PRE_CMD_SMASH and
[fs/lustre-release.git] / lustre / ldlm / ldlm_request.c
index 7540b69..37868ca 100644 (file)
@@ -559,11 +559,9 @@ int ldlm_cli_cancel(struct lustre_handle *lockh)
                 rc = ptlrpc_queue_wait(req);
 
                 if (rc == ESTALE) {
-                        char str[PTL_NALFMT_SIZE];
-                        CERROR("client/server (nid %s) out of sync"
-                               " -- not fatal\n",
-                               ptlrpc_peernid2str(&req->rq_import->
-                                                  imp_connection->c_peer, str));
+                        CERROR("client/server (nid "LPU64") out of sync--not "
+                               "fatal\n",
+                               req->rq_import->imp_connection->c_peer.peer_nid);
                 } else if (rc == -ETIMEDOUT) {
                         ptlrpc_req_finished(req);
                         GOTO(restart, rc);
@@ -592,16 +590,13 @@ int ldlm_cli_cancel(struct lustre_handle *lockh)
         return rc;
 }
 
-/* when called with LDLM_ASYNC the blocking callback will be handled
- * in a thread and this function will return after the thread has been
- * asked to call the callback.  when called with LDLM_SYNC the blocking
- * callback will be performed in this function. */
-int ldlm_cancel_lru(struct ldlm_namespace *ns, ldlm_sync_t sync)
+int ldlm_cancel_lru(struct ldlm_namespace *ns)
 {
         struct list_head *tmp, *next;
-        struct ldlm_lock *lock;
-        int count, rc = 0;
+#ifndef __KERNEL__
         LIST_HEAD(cblist);
+#endif
+        int count, rc = 0;
         ENTRY;
 
         l_lock(&ns->ns_lock);
@@ -613,7 +608,7 @@ int ldlm_cancel_lru(struct ldlm_namespace *ns, ldlm_sync_t sync)
         }
 
         list_for_each_safe(tmp, next, &ns->ns_unused_list) {
-
+                struct ldlm_lock *lock;
                 lock = list_entry(tmp, struct ldlm_lock, l_lru);
 
                 LASSERT(!lock->l_readers && !lock->l_writers);
@@ -627,21 +622,25 @@ int ldlm_cancel_lru(struct ldlm_namespace *ns, ldlm_sync_t sync)
 
                 LDLM_LOCK_GET(lock); /* dropped by bl thread */
                 ldlm_lock_remove_from_lru(lock);
-                if (sync == LDLM_ASYNC)
-                        ldlm_bl_to_thread(ns, NULL, lock);
-                else
-                        list_add(&lock->l_lru, &cblist);
+#if __KERNEL__
+                ldlm_bl_to_thread(ns, NULL, lock);
+#else
+                list_add(&lock->l_lru, &cblist);
+#endif
 
                 if (--count == 0)
                         break;
         }
         l_unlock(&ns->ns_lock);
+#ifndef __KERNEL__
+        while (!list_empty(&cblist)) {
+                struct ldlm_lock *lock;
 
-        list_for_each_safe(tmp, next, &cblist) {
-                lock = list_entry(tmp, struct ldlm_lock, l_lru);
+                lock = list_entry(cblist.next, struct ldlm_lock, l_lru);
                 list_del_init(&lock->l_lru);
-                ldlm_handle_bl_callback(ns, NULL, lock);
+                liblustre_ldlm_handle_bl_callback(ns, NULL, lock);
         }
+#endif
         RETURN(rc);
 }