@@ -1186,6 +1186,7 @@ struct ldlm_resource *ldlm_resource_get(struct ldlm_namespace *ns,
struct ldlm_resource *parent,
const struct ldlm_res_id *,
enum ldlm_type type, int create);
+struct ldlm_resource *ldlm_resource_getref(struct ldlm_resource *res);
void ldlm_resource_putref(struct ldlm_resource *res);
void ldlm_resource_add_lock(struct ldlm_resource *res,
struct list_head *head,
@@ -1981,10 +1981,16 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
struct libcfs_debug_msg_data *msgdata,
const char *fmt, ...)
{
- va_list args;
struct obd_export *exp = lock->l_export;
- struct ldlm_resource *resource = lock->l_resource;
+ struct ldlm_resource *resource = NULL;
char *nid = "local";
+ va_list args;
+
+ if (spin_trylock(&lock->l_lock)) {
+ if (lock->l_resource)
+ resource = ldlm_resource_getref(lock->l_resource);
+ spin_unlock(&lock->l_lock);
+ }
va_start(args, fmt);
@@ -2099,5 +2105,6 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
break;
}
va_end(args);
+ ldlm_resource_putref(resource);
}
EXPORT_SYMBOL(_ldlm_lock_debug);
@@ -402,7 +402,7 @@ static int ldlm_namespace_debugfs_register(struct ldlm_namespace *ns)
#undef MAX_STRING_SIZE
-static struct ldlm_resource *ldlm_resource_getref(struct ldlm_resource *res)
+struct ldlm_resource *ldlm_resource_getref(struct ldlm_resource *res)
{
LASSERT(res);
LASSERT(res != LP_POISON);