From 14f27eb0f42298c8ef850ef1401c7ebf8067aeb9 Mon Sep 17 00:00:00 2001 From: phil Date: Sat, 12 Feb 2005 21:03:22 +0000 Subject: [PATCH] Add an l_check_ns_lock to go with l_check_no_ns_lock. --- lustre/ldlm/l_lock.c | 20 ++++++++++++++++++++ lustre/ldlm/ldlm_internal.h | 1 + 2 files changed, 21 insertions(+) diff --git a/lustre/ldlm/l_lock.c b/lustre/ldlm/l_lock.c index af6a15b..baf43ab 100644 --- a/lustre/ldlm/l_lock.c +++ b/lustre/ldlm/l_lock.c @@ -117,6 +117,18 @@ int l_has_lock(struct lustre_lock *lock) #ifdef __KERNEL__ #include +void l_check_ns_lock(struct ldlm_namespace *ns) +{ + static unsigned long next_msg; + + if (!l_has_lock(&ns->ns_lock) && time_after(jiffies, next_msg)) { + CERROR("namespace %s lock not held when it should be; tell " + "phil\n", ns->ns_name); + portals_debug_dumpstack(NULL); + next_msg = jiffies + 60 * HZ; + } +} + void l_check_no_ns_lock(struct ldlm_namespace *ns) { static unsigned long next_msg; @@ -130,6 +142,14 @@ void l_check_no_ns_lock(struct ldlm_namespace *ns) } #else +void l_check_ns_lock(struct ldlm_namespace *ns) +{ + if (l_has_lock(&ns->ns_lock)) { + CERROR("namespace %s lock not held when it should be; tell " + "phil\n", ns->ns_name); + } +} + void l_check_no_ns_lock(struct ldlm_namespace *ns) { if (l_has_lock(&ns->ns_lock)) { diff --git a/lustre/ldlm/ldlm_internal.h b/lustre/ldlm/ldlm_internal.h index c18884b..ccaafdc 100644 --- a/lustre/ldlm/ldlm_internal.h +++ b/lustre/ldlm/ldlm_internal.h @@ -47,6 +47,7 @@ int ldlm_process_flock_lock(struct ldlm_lock *lock, int *flags, int first_enq, ldlm_error_t *err); /* l_lock.c */ +void l_check_ns_lock(struct ldlm_namespace *ns); void l_check_no_ns_lock(struct ldlm_namespace *ns); extern struct proc_dir_entry *ldlm_svc_proc_dir; -- 1.8.3.1