Whamcloud - gitweb
Revert "b=22244 delegate lock cancel to blocking thread"
authorRobert Read <robert.read@oracle.com>
Mon, 28 Jun 2010 18:04:00 +0000 (11:04 -0700)
committerRobert Read <robert.read@oracle.com>
Mon, 28 Jun 2010 18:04:00 +0000 (11:04 -0700)
This reverts commit f96aff96fae1fcb3d06fd40ae4837ba975df12e3.

Reverting because of dependency on bug 21128.

lustre/include/lustre_dlm.h
lustre/ldlm/ldlm_lockd.c
lustre/ldlm/ldlm_request.c

index d6d3c73..76f5814 100644 (file)
@@ -1120,8 +1120,6 @@ int ldlm_cancel_resource_local(struct ldlm_resource *res,
                                ldlm_policy_data_t *policy,
                                ldlm_mode_t mode, int lock_flags,
                                ldlm_cancel_flags_t cancel_flags, void *opaque);
                                ldlm_policy_data_t *policy,
                                ldlm_mode_t mode, int lock_flags,
                                ldlm_cancel_flags_t cancel_flags, void *opaque);
-int ldlm_cli_cancel_list_local(cfs_list_t *cancels, int count,
-                               ldlm_cancel_flags_t flags);
 int ldlm_cli_cancel_list(cfs_list_t *head, int count,
                          struct ptlrpc_request *req, ldlm_cancel_flags_t flags);
 
 int ldlm_cli_cancel_list(cfs_list_t *head, int count,
                          struct ptlrpc_request *req, ldlm_cancel_flags_t flags);
 
index 8358d58..ca784e8 100644 (file)
@@ -2224,10 +2224,8 @@ static int ldlm_bl_thread_main(void *arg)
                 if (blwi->blwi_count) {
                         /* The special case when we cancel locks in lru
                          * asynchronously, we pass the list of locks here.
                 if (blwi->blwi_count) {
                         /* The special case when we cancel locks in lru
                          * asynchronously, we pass the list of locks here.
-                         * Thus locks are marked LDLM_FL_CANCELING, but NOT
-                         * canceled locally yet. */
-                        ldlm_cli_cancel_list_local(&blwi->blwi_head,
-                                                   blwi->blwi_count, 0);
+                         * Thus lock is marked LDLM_FL_CANCELING, and already
+                         * canceled locally. */
                         ldlm_cli_cancel_list(&blwi->blwi_head,
                                              blwi->blwi_count, NULL, 0);
                 } else {
                         ldlm_cli_cancel_list(&blwi->blwi_head,
                                              blwi->blwi_count, NULL, 0);
                 } else {
@@ -2658,7 +2656,6 @@ EXPORT_SYMBOL(ldlm_namespace_foreach);
 EXPORT_SYMBOL(ldlm_namespace_foreach_res);
 EXPORT_SYMBOL(ldlm_resource_iterate);
 EXPORT_SYMBOL(ldlm_cancel_resource_local);
 EXPORT_SYMBOL(ldlm_namespace_foreach_res);
 EXPORT_SYMBOL(ldlm_resource_iterate);
 EXPORT_SYMBOL(ldlm_cancel_resource_local);
-EXPORT_SYMBOL(ldlm_cli_cancel_list_local);
 EXPORT_SYMBOL(ldlm_cli_cancel_list);
 
 /* ldlm_lockd.c */
 EXPORT_SYMBOL(ldlm_cli_cancel_list);
 
 /* ldlm_lockd.c */
index 4c7f180..8d651d9 100644 (file)
@@ -1269,8 +1269,8 @@ int ldlm_cli_cancel(struct lustre_handle *lockh)
 
 /* XXX until we will have compound requests and can cut cancels from generic rpc
  * we need send cancels with LDLM_FL_BL_AST flag as separate rpc */
 
 /* XXX until we will have compound requests and can cut cancels from generic rpc
  * we need send cancels with LDLM_FL_BL_AST flag as separate rpc */
-int ldlm_cli_cancel_list_local(cfs_list_t *cancels, int count,
-                               ldlm_cancel_flags_t flags)
+static int ldlm_cancel_list(cfs_list_t *cancels, int count,
+                            ldlm_cancel_flags_t flags)
 {
         CFS_LIST_HEAD(head);
         struct ldlm_lock *lock, *next;
 {
         CFS_LIST_HEAD(head);
         struct ldlm_lock *lock, *next;
@@ -1473,8 +1473,9 @@ ldlm_cancel_lru_policy(struct ldlm_namespace *ns, int flags)
  *
  * flags & LDLM_CANCEL_AGED -   cancel alocks according to "aged policy".
  */
  *
  * flags & LDLM_CANCEL_AGED -   cancel alocks according to "aged policy".
  */
-static int ldlm_prepare_lru_list(struct ldlm_namespace *ns, cfs_list_t *cancels,
-                                 int count, int max, int flags)
+int ldlm_cancel_lru_local(struct ldlm_namespace *ns, cfs_list_t *cancels,
+                          int count, int max, ldlm_cancel_flags_t cancel_flags,
+                          int flags)
 {
         ldlm_cancel_lru_policy_t pf;
         struct ldlm_lock *lock, *next;
 {
         ldlm_cancel_lru_policy_t pf;
         struct ldlm_lock *lock, *next;
@@ -1584,18 +1585,7 @@ static int ldlm_prepare_lru_list(struct ldlm_namespace *ns, cfs_list_t *cancels,
                 unused--;
         }
         cfs_spin_unlock(&ns->ns_unused_lock);
                 unused--;
         }
         cfs_spin_unlock(&ns->ns_unused_lock);
-        RETURN(added);
-}
-
-int ldlm_cancel_lru_local(struct ldlm_namespace *ns, cfs_list_t *cancels,
-                          int count, int max, ldlm_cancel_flags_t cancel_flags,
-                          int flags)
-{
-        int added;
-        added = ldlm_prepare_lru_list(ns, cancels, count, max, flags);
-        if (added <= 0)
-                return added;
-        return ldlm_cli_cancel_list_local(cancels, added, cancel_flags);
+        RETURN(ldlm_cancel_list(cancels, added, cancel_flags));
 }
 
 /* when called with LDLM_ASYNC the blocking callback will be handled
 }
 
 /* when called with LDLM_ASYNC the blocking callback will be handled
@@ -1612,9 +1602,8 @@ int ldlm_cancel_lru(struct ldlm_namespace *ns, int nr, ldlm_sync_t mode,
 #ifndef __KERNEL__
         mode = LDLM_SYNC; /* force to be sync in user space */
 #endif
 #ifndef __KERNEL__
         mode = LDLM_SYNC; /* force to be sync in user space */
 #endif
-        /* Just prepare the list of locks, do not actually cancel them yet.
-         * Locks are cancelled later in a separate thread. */
-        count = ldlm_prepare_lru_list(ns, &cancels, nr, 0, flags);
+        count = ldlm_cancel_lru_local(ns, &cancels, nr, 0, 0, flags);
+
         rc = ldlm_bl_to_thread_list(ns, NULL, &cancels, count, mode);
         if (rc == 0)
                 RETURN(count);
         rc = ldlm_bl_to_thread_list(ns, NULL, &cancels, count, mode);
         if (rc == 0)
                 RETURN(count);
@@ -1674,7 +1663,7 @@ int ldlm_cancel_resource_local(struct ldlm_resource *res,
         }
         unlock_res(res);
 
         }
         unlock_res(res);
 
-        RETURN(ldlm_cli_cancel_list_local(cancels, count, cancel_flags));
+        RETURN(ldlm_cancel_list(cancels, count, cancel_flags));
 }
 
 /* If @req is NULL, send CANCEL request to server with handles of locks
 }
 
 /* If @req is NULL, send CANCEL request to server with handles of locks