From 464acf049cb2059cdf619b74b09506c2383248c8 Mon Sep 17 00:00:00 2001 From: Johann Lombardi Date: Tue, 1 Jun 2010 01:18:55 +0200 Subject: [PATCH] Revert "b=22244 delegate lock cancel to blocking thread" This reverts commit 6ac3b520e192f1c1aa26e5de047976e25766a885. Reverting all patches from 22244 & 21128 because of test failures. See 22244 for more info. --- lustre/include/lustre_dlm.h | 2 -- lustre/ldlm/ldlm_lockd.c | 7 ++----- lustre/ldlm/ldlm_request.c | 29 ++++++++--------------------- 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/lustre/include/lustre_dlm.h b/lustre/include/lustre_dlm.h index 63800eb..ca3f9c0 100644 --- a/lustre/include/lustre_dlm.h +++ b/lustre/include/lustre_dlm.h @@ -895,8 +895,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); -int ldlm_cli_cancel_list_local(struct list_head *cancels, int count, - ldlm_cancel_flags_t flags); int ldlm_cli_cancel_list(struct list_head *head, int count, struct ptlrpc_request *req, int off); diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 56a8421..a656fa8 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -2015,10 +2015,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. - * 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 { @@ -2440,7 +2438,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_cli_cancel_list_local); EXPORT_SYMBOL(ldlm_cli_cancel_list); /* ldlm_lockd.c */ diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index c944a6d..88500d5 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -1136,8 +1136,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 */ -int ldlm_cli_cancel_list_local(struct list_head *cancels, int count, - ldlm_cancel_flags_t flags) +static int ldlm_cancel_list(struct list_head *cancels, int count, + ldlm_cancel_flags_t flags) { CFS_LIST_HEAD(head); struct ldlm_lock *lock, *next; @@ -1337,9 +1337,9 @@ ldlm_cancel_lru_policy(struct ldlm_namespace *ns, int flags) * sending any rpcs or waiting for any * outstanding rpc to complete */ -static int ldlm_prepare_lru_list(struct ldlm_namespace *ns, - struct list_head *cancels, - int count, int max, int flags) +int ldlm_cancel_lru_local(struct ldlm_namespace *ns, struct list_head *cancels, + int count, int max, ldlm_cancel_flags_t cancel_flags, + int flags) { ldlm_cancel_lru_policy_t pf; struct ldlm_lock *lock, *next; @@ -1461,18 +1461,7 @@ static int ldlm_prepare_lru_list(struct ldlm_namespace *ns, unused--; } spin_unlock(&ns->ns_unused_lock); - RETURN(added); -} - -int ldlm_cancel_lru_local(struct ldlm_namespace *ns, struct list_head *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 @@ -1489,9 +1478,7 @@ 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 - /* 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) @@ -1553,7 +1540,7 @@ int ldlm_cancel_resource_local(struct ldlm_resource *res, unlock_res(res); /* Handle only @count inserted locks. */ - 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 -- 1.8.3.1