aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/heartbeat.c
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2008-02-01 17:39:35 -0500
committerMark Fasheh <mfasheh@suse.com>2008-04-18 11:56:04 -0400
commit4670c46ded9a18268d1265417ff4ac72145a7917 (patch)
tree4f70822ddee389a9c8ed572b215a3355c20db3a1 /fs/ocfs2/heartbeat.c
parent8f2c9c1b16bf6ed0903b29c49d56fa0109a390e4 (diff)
ocfs2: Introduce the new ocfs2_cluster_connect/disconnect() API.
This step introduces a cluster stack agnostic API for initializing and exiting. fs/ocfs2/dlmglue.c no longer uses o2cb/o2dlm knowledge to connect to the stack. It is all handled in stackglue.c. heartbeat.c no longer needs to know how it gets called. ocfs2_do_node_down() is now a clean recovery trigger. The big gotcha is the ordering of initializations and de-initializations done underneath ocfs2_cluster_connect(). ocfs2_dlm_init() used to do all o2dlm initialization in one block. Thus, the o2dlm functionality of ocfs2_cluster_connect() is very straightforward. ocfs2_dlm_shutdown(), however, did a few things between de-registration of the eviction callback and actually shutting down the domain. Now de-registration and shutdown of the domain are wrapped within the single ocfs2_cluster_disconnect() call. I've checked the code paths to make sure we can safely tear down things in ocfs2_dlm_shutdown() before calling ocfs2_cluster_disconnect(). The filesystem has already set itself to ignore the callback. Signed-off-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/heartbeat.c')
-rw-r--r--fs/ocfs2/heartbeat.c40
1 files changed, 8 insertions, 32 deletions
diff --git a/fs/ocfs2/heartbeat.c b/fs/ocfs2/heartbeat.c
index 80de2397c161..dcac1a487288 100644
--- a/fs/ocfs2/heartbeat.c
+++ b/fs/ocfs2/heartbeat.c
@@ -30,8 +30,6 @@
30#include <linux/highmem.h> 30#include <linux/highmem.h>
31#include <linux/kmod.h> 31#include <linux/kmod.h>
32 32
33#include <dlm/dlmapi.h>
34
35#define MLOG_MASK_PREFIX ML_SUPER 33#define MLOG_MASK_PREFIX ML_SUPER
36#include <cluster/masklog.h> 34#include <cluster/masklog.h>
37 35
@@ -64,19 +62,20 @@ void ocfs2_init_node_maps(struct ocfs2_super *osb)
64 ocfs2_node_map_init(&osb->osb_recovering_orphan_dirs); 62 ocfs2_node_map_init(&osb->osb_recovering_orphan_dirs);
65} 63}
66 64
67static void ocfs2_do_node_down(int node_num, 65void ocfs2_do_node_down(int node_num, void *data)
68 struct ocfs2_super *osb)
69{ 66{
67 struct ocfs2_super *osb = data;
68
70 BUG_ON(osb->node_num == node_num); 69 BUG_ON(osb->node_num == node_num);
71 70
72 mlog(0, "ocfs2: node down event for %d\n", node_num); 71 mlog(0, "ocfs2: node down event for %d\n", node_num);
73 72
74 if (!osb->dlm) { 73 if (!osb->cconn) {
75 /* 74 /*
76 * No DLM means we're not even ready to participate yet. 75 * No cluster connection means we're not even ready to
77 * We check the slots after the DLM comes up, so we will 76 * participate yet. We check the slots after the cluster
78 * notice the node death then. We can safely ignore it 77 * comes up, so we will notice the node death then. We
79 * here. 78 * can safely ignore it here.
80 */ 79 */
81 return; 80 return;
82 } 81 }
@@ -84,29 +83,6 @@ static void ocfs2_do_node_down(int node_num,
84 ocfs2_recovery_thread(osb, node_num); 83 ocfs2_recovery_thread(osb, node_num);
85} 84}
86 85
87/* Called from the dlm when it's about to evict a node. We may also
88 * get a heartbeat callback later. */
89static void ocfs2_dlm_eviction_cb(int node_num,
90 void *data)
91{
92 struct ocfs2_super *osb = (struct ocfs2_super *) data;
93 struct super_block *sb = osb->sb;
94
95 mlog(ML_NOTICE, "device (%u,%u): dlm has evicted node %d\n",
96 MAJOR(sb->s_dev), MINOR(sb->s_dev), node_num);
97
98 ocfs2_do_node_down(node_num, osb);
99}
100
101void ocfs2_setup_hb_callbacks(struct ocfs2_super *osb)
102{
103 /* Not exactly a heartbeat callback, but leads to essentially
104 * the same path so we set it up here. */
105 dlm_setup_eviction_cb(&osb->osb_eviction_cb,
106 ocfs2_dlm_eviction_cb,
107 osb);
108}
109
110void ocfs2_stop_heartbeat(struct ocfs2_super *osb) 86void ocfs2_stop_heartbeat(struct ocfs2_super *osb)
111{ 87{
112 int ret; 88 int ret;