Whamcloud - gitweb
b=13872
[fs/lustre-release.git] / lustre / ldlm / ldlm_request.c
index 771ed62..8aff2f6 100644 (file)
@@ -245,7 +245,7 @@ int ldlm_cli_enqueue_local(struct ldlm_namespace *ns,
         ENTRY;
 
         LASSERT(!(*flags & LDLM_FL_REPLAY));
-        if (unlikely(ns->ns_client)) {
+        if (unlikely(ns_is_client(ns))) {
                 CERROR("Trying to enqueue local lock in a shadow namespace\n");
                 LBUG();
         }
@@ -686,7 +686,7 @@ static int ldlm_cli_convert_local(struct ldlm_lock *lock, int new_mode,
         struct ldlm_resource *res;
         int rc;
         ENTRY;
-        if (lock->l_resource->lr_namespace->ns_client) {
+        if (ns_is_client(lock->l_resource->lr_namespace)) {
                 CERROR("Trying to cancel local lock\n");
                 LBUG();
         }
@@ -812,7 +812,7 @@ static int ldlm_cli_cancel_local(struct ldlm_lock *lock)
                 }
                 ldlm_lock_cancel(lock);
         } else {
-                if (lock->l_resource->lr_namespace->ns_client) {
+                if (ns_is_client(lock->l_resource->lr_namespace)) {
                         LDLM_ERROR(lock, "Trying to cancel local lock");
                         LBUG();
                 }
@@ -889,9 +889,9 @@ int ldlm_cli_cancel_req(struct obd_export *exp, struct list_head *cancels,
         while (1) {
                 imp = class_exp2cliimp(exp);
                 if (imp == NULL || imp->imp_invalid) {
-                        CDEBUG(D_HA, "skipping cancel on invalid import %p\n",
-                               imp);
-                        break;
+                        CDEBUG(D_DLMTRACE,
+                               "skipping cancel on invalid import %p\n", imp);
+                        RETURN(count);
                 }
 
                 req = ptlrpc_prep_req(imp, LUSTRE_DLM_VERSION, LDLM_CANCEL, 2,
@@ -957,6 +957,10 @@ int ldlm_cli_update_pool(struct ptlrpc_request *req)
         if (!imp_connect_lru_resize(req->rq_import))
                 RETURN(0);
 
+        if (lustre_msg_get_slv(req->rq_repmsg) == 0 ||
+            lustre_msg_get_limit(req->rq_repmsg) == 0)
+                RETURN(0);
+
         pl = ldlm_imp2pl(req->rq_import);
         
         spin_lock(&pl->pl_lock);
@@ -1050,6 +1054,8 @@ int ldlm_cancel_lru_local(struct ldlm_namespace *ns, struct list_head *cancels,
         while (!list_empty(&ns->ns_unused_list)) {
                 struct ldlm_pool *pl = &ns->ns_pool;
 
+                LASSERT(unused >= 0);
+
                 if (max && added >= max)
                         break;
 
@@ -1244,7 +1250,7 @@ int ldlm_cancel_resource_local(struct ldlm_resource *res,
 
                 /* See CBPENDING comment in ldlm_cancel_lru */
                 lock->l_flags |= LDLM_FL_CBPENDING | LDLM_FL_CANCELING |
-                        lock_flags;
+                                 lock_flags;
 
                 LASSERT(list_empty(&lock->l_bl_ast));
                 list_add(&lock->l_bl_ast, cancels);
@@ -1316,7 +1322,8 @@ int ldlm_cli_cancel_list(struct list_head *cancels, int count,
                                 ldlm_cancel_pack(req, off, cancels, count);
                         else
                                 res = ldlm_cli_cancel_req(lock->l_conn_export,
-                                                          cancels, count, flags);
+                                                          cancels, count,
+                                                          flags);
                 } else {
                         res = ldlm_cli_cancel_req(lock->l_conn_export,
                                                   cancels, 1, flags);
@@ -1434,7 +1441,7 @@ int ldlm_cli_join_lru(struct ldlm_namespace *ns,
         int count = 0;
         ENTRY;
 
-        LASSERT(ns->ns_client == LDLM_NAMESPACE_CLIENT);
+        LASSERT(ns_is_client(ns));
 
         res = ldlm_resource_get(ns, NULL, res_id, LDLM_EXTENT, 0);
         if (res == NULL)