From 78af9439dd30d6b226bf35d976be989d0a9cbdc2 Mon Sep 17 00:00:00 2001 From: shaver Date: Sat, 19 Oct 2002 11:09:16 +0000 Subject: [PATCH] - Rename ldlm_namespace_cleanup's "local" parameter to "local_only" for clarity. - Remove spurious LBUG() or two. - Export the cleanup and dump symbols we use in recovery. --- lustre/include/linux/lustre_dlm.h | 2 +- lustre/ldlm/ldlm_lock.c | 3 +-- lustre/ldlm/ldlm_lockd.c | 6 ++++-- lustre/ldlm/ldlm_request.c | 17 ----------------- lustre/ldlm/ldlm_resource.c | 18 +++++++++--------- 5 files changed, 15 insertions(+), 31 deletions(-) diff --git a/lustre/include/linux/lustre_dlm.h b/lustre/include/linux/lustre_dlm.h index 454b589..3bd8320 100644 --- a/lustre/include/linux/lustre_dlm.h +++ b/lustre/include/linux/lustre_dlm.h @@ -338,7 +338,7 @@ int ldlm_regression_stop(void); /* resource.c */ struct ldlm_namespace *ldlm_namespace_new(char *name, __u32 local); -int ldlm_namespace_cleanup(struct ldlm_namespace *ns, int local); +int ldlm_namespace_cleanup(struct ldlm_namespace *ns, int local_only); int ldlm_namespace_free(struct ldlm_namespace *ns); int ldlm_proc_setup(struct obd_device *obd); void ldlm_proc_cleanup(struct obd_device *obd); diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index b6df7fe..065edd9 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -192,7 +192,6 @@ void ldlm_lock_destroy(struct ldlm_lock *lock) if (lock->l_readers || lock->l_writers) { LDLM_DEBUG(lock, "lock still has references"); ldlm_lock_dump(lock); - LBUG(); } if (!list_empty(&lock->l_res_link)) { @@ -862,7 +861,7 @@ void ldlm_cancel_locks_for_export(struct obd_export *exp) struct ldlm_resource *res; lock = list_entry(iter, struct ldlm_lock, l_export_chain); res = ldlm_resource_getref(lock->l_resource); - LDLM_DEBUG(lock, "cancelling lock for export %p", exp); + LDLM_DEBUG(lock, "export %p", exp); ldlm_lock_cancel(lock); ldlm_reprocess_all(res); ldlm_resource_put(res); diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 1f7b0dd..a6abc5e 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -56,8 +56,8 @@ static void waiting_locks_callback(unsigned long unused) l_pending_chain); if (l->l_callback_timeout > jiffies) break; - LDLM_DEBUG(l, "timer expired, recovering conn %p", - l->l_export->exp_connection); + LDLM_DEBUG(l, "timer expired, recovering exp %p on conn %p", + l->l_export, l->l_export->exp_connection); recovd_conn_fail(l->l_export->exp_connection); } spin_unlock_bh(&waiting_locks_spinlock); @@ -707,7 +707,9 @@ EXPORT_SYMBOL(ldlm_regression_start); EXPORT_SYMBOL(ldlm_regression_stop); EXPORT_SYMBOL(ldlm_lock_dump); EXPORT_SYMBOL(ldlm_namespace_new); +EXPORT_SYMBOL(ldlm_namespace_cleanup); EXPORT_SYMBOL(ldlm_namespace_free); +EXPORT_SYMBOL(ldlm_namespace_dump); EXPORT_SYMBOL(ldlm_cancel_locks_for_export); EXPORT_SYMBOL(l_lock); EXPORT_SYMBOL(l_unlock); diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index af7f9a9..90ca711 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -49,23 +49,6 @@ static int expired_completion_wait(void *data) RETURN(0); } -#if 0 -static int expired_completion_wait(void *data) -{ - struct ldlm_lock *lock = data; - struct ptlrpc_connection *conn = - class_conn2cliimp(lock->l_connh)->imp_connection; - - if (!conn) { - CERROR("lock %p has NULL import connection\n", lock); - RETURN(1); - } - - class_signal_connection_failure(conn); - RETURN(0); -} -#endif - int ldlm_completion_ast(struct ldlm_lock *lock, int flags) { struct l_wait_info lwi = diff --git a/lustre/ldlm/ldlm_resource.c b/lustre/ldlm/ldlm_resource.c index 5434363..b7f386a 100644 --- a/lustre/ldlm/ldlm_resource.c +++ b/lustre/ldlm/ldlm_resource.c @@ -120,9 +120,9 @@ struct ldlm_namespace *ldlm_namespace_new(char *name, __u32 client) extern struct ldlm_lock *ldlm_lock_get(struct ldlm_lock *lock); -/* If 'local' is true, don't try to tell the server, just cleanup. */ +/* If 'local_only' is true, don't try to tell the server, just cleanup. */ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q, - int local) + int local_only) { struct list_head *tmp, *pos; int rc = 0, client = res->lr_namespace->ns_client; @@ -136,13 +136,13 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q, if (client) { struct lustre_handle lockh; ldlm_lock2handle(lock, &lockh); - if (!local) { + if (!local_only) { rc = ldlm_cli_cancel(&lockh); if (rc) CERROR("ldlm_cli_cancel: %d\n", rc); } /* Force local cleanup on errors, too. */ - if (local || rc != ELDLM_OK) + if (local_only || rc != ELDLM_OK) ldlm_lock_cancel(lock); } else { LDLM_DEBUG(lock, "Freeing a lock still held by a " @@ -155,7 +155,7 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q, } } -int ldlm_namespace_cleanup(struct ldlm_namespace *ns, int local) +int ldlm_namespace_cleanup(struct ldlm_namespace *ns, int local_only) { int i; @@ -167,11 +167,11 @@ int ldlm_namespace_cleanup(struct ldlm_namespace *ns, int local) res = list_entry(tmp, struct ldlm_resource, lr_hash); ldlm_resource_getref(res); - cleanup_resource(res, &res->lr_granted, local); - cleanup_resource(res, &res->lr_converting, local); - cleanup_resource(res, &res->lr_waiting, local); + cleanup_resource(res, &res->lr_granted, local_only); + cleanup_resource(res, &res->lr_converting, local_only); + cleanup_resource(res, &res->lr_waiting, local_only); - if (!ldlm_resource_put(res)) { + if (!ldlm_resource_put(res) && !local_only) { CERROR("Resource refcount nonzero (%d) after " "lock cleanup; forcing cleanup.\n", atomic_read(&res->lr_refcount)); -- 1.8.3.1