]> Pileus Git - ~andy/linux/blobdiff - fs/ocfs2/dlm/dlmdomain.c
Merge commit 'v2.6.27-rc1' into x86/core
[~andy/linux] / fs / ocfs2 / dlm / dlmdomain.c
index 4f7695c851ed509a0025a298177430c3ec9ceea8..63f8125824e8200a08c5daa3bebdcec6bf8374e1 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/spinlock.h>
 #include <linux/delay.h>
 #include <linux/err.h>
+#include <linux/debugfs.h>
 
 #include "cluster/heartbeat.h"
 #include "cluster/nodemanager.h"
@@ -40,8 +41,8 @@
 
 #include "dlmapi.h"
 #include "dlmcommon.h"
-
 #include "dlmdomain.h"
+#include "dlmdebug.h"
 
 #include "dlmver.h"
 
@@ -298,6 +299,8 @@ static int dlm_wait_on_domain_helper(const char *domain)
 
 static void dlm_free_ctxt_mem(struct dlm_ctxt *dlm)
 {
+       dlm_destroy_debugfs_subroot(dlm);
+
        if (dlm->lockres_hash)
                dlm_free_pagevec((void **)dlm->lockres_hash, DLM_HASH_PAGES);
 
@@ -395,6 +398,7 @@ static void dlm_destroy_dlm_worker(struct dlm_ctxt *dlm)
 static void dlm_complete_dlm_shutdown(struct dlm_ctxt *dlm)
 {
        dlm_unregister_domain_handlers(dlm);
+       dlm_debug_shutdown(dlm);
        dlm_complete_thread(dlm);
        dlm_complete_recovery_thread(dlm);
        dlm_destroy_dlm_worker(dlm);
@@ -1415,6 +1419,12 @@ static int dlm_join_domain(struct dlm_ctxt *dlm)
                goto bail;
        }
 
+       status = dlm_debug_init(dlm);
+       if (status < 0) {
+               mlog_errno(status);
+               goto bail;
+       }
+
        status = dlm_launch_thread(dlm);
        if (status < 0) {
                mlog_errno(status);
@@ -1482,6 +1492,7 @@ bail:
 
        if (status) {
                dlm_unregister_domain_handlers(dlm);
+               dlm_debug_shutdown(dlm);
                dlm_complete_thread(dlm);
                dlm_complete_recovery_thread(dlm);
                dlm_destroy_dlm_worker(dlm);
@@ -1494,6 +1505,7 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain,
                                u32 key)
 {
        int i;
+       int ret;
        struct dlm_ctxt *dlm = NULL;
 
        dlm = kzalloc(sizeof(*dlm), GFP_KERNEL);
@@ -1526,6 +1538,15 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain,
        dlm->key = key;
        dlm->node_num = o2nm_this_node();
 
+       ret = dlm_create_debugfs_subroot(dlm);
+       if (ret < 0) {
+               dlm_free_pagevec((void **)dlm->lockres_hash, DLM_HASH_PAGES);
+               kfree(dlm->name);
+               kfree(dlm);
+               dlm = NULL;
+               goto leave;
+       }
+
        spin_lock_init(&dlm->spinlock);
        spin_lock_init(&dlm->master_lock);
        spin_lock_init(&dlm->ast_lock);
@@ -1851,8 +1872,13 @@ static int __init dlm_init(void)
                goto error;
        }
 
+       status = dlm_create_debugfs_root();
+       if (status)
+               goto error;
+
        return 0;
 error:
+       dlm_unregister_net_handlers();
        dlm_destroy_lock_cache();
        dlm_destroy_master_caches();
        dlm_destroy_mle_cache();
@@ -1861,6 +1887,7 @@ error:
 
 static void __exit dlm_exit (void)
 {
+       dlm_destroy_debugfs_root();
        dlm_unregister_net_handlers();
        dlm_destroy_lock_cache();
        dlm_destroy_master_caches();