diff options
author | Kurt Hackel <kurt.hackel@oracle.com> | 2006-04-27 21:03:49 -0400 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2006-06-26 17:42:47 -0400 |
commit | ab27eb6f47092923a92f7c164dcf9be3b76f3944 (patch) | |
tree | 2ac759bb499bb30c76f3b85e815c7c75da7281ef /fs/ocfs2 | |
parent | 8bc674cb4834fb25206b7f7f5e37fe571aa76b34 (diff) |
ocfs2: Better tracking for recovery state changes
Signed-off-by: Kurt Hackel <kurt.hackel@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/dlm/dlmrecovery.c | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index 8a3f0173ff56..ee0860bb6734 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c | |||
@@ -115,12 +115,31 @@ static u64 dlm_get_next_mig_cookie(void) | |||
115 | return c; | 115 | return c; |
116 | } | 116 | } |
117 | 117 | ||
118 | static inline void dlm_set_reco_dead_node(struct dlm_ctxt *dlm, | ||
119 | u8 dead_node) | ||
120 | { | ||
121 | assert_spin_locked(&dlm->spinlock); | ||
122 | if (dlm->reco.dead_node != dead_node) | ||
123 | mlog(0, "%s: changing dead_node from %u to %u\n", | ||
124 | dlm->name, dlm->reco.dead_node, dead_node); | ||
125 | dlm->reco.dead_node = dead_node; | ||
126 | } | ||
127 | |||
128 | static inline void dlm_set_reco_master(struct dlm_ctxt *dlm, | ||
129 | u8 master) | ||
130 | { | ||
131 | assert_spin_locked(&dlm->spinlock); | ||
132 | mlog(0, "%s: changing new_master from %u to %u\n", | ||
133 | dlm->name, dlm->reco.new_master, master); | ||
134 | dlm->reco.new_master = master; | ||
135 | } | ||
136 | |||
118 | static inline void dlm_reset_recovery(struct dlm_ctxt *dlm) | 137 | static inline void dlm_reset_recovery(struct dlm_ctxt *dlm) |
119 | { | 138 | { |
120 | spin_lock(&dlm->spinlock); | 139 | spin_lock(&dlm->spinlock); |
121 | clear_bit(dlm->reco.dead_node, dlm->recovery_map); | 140 | clear_bit(dlm->reco.dead_node, dlm->recovery_map); |
122 | dlm->reco.dead_node = O2NM_INVALID_NODE_NUM; | 141 | dlm_set_reco_dead_node(dlm, O2NM_INVALID_NODE_NUM); |
123 | dlm->reco.new_master = O2NM_INVALID_NODE_NUM; | 142 | dlm_set_reco_master(dlm, O2NM_INVALID_NODE_NUM); |
124 | spin_unlock(&dlm->spinlock); | 143 | spin_unlock(&dlm->spinlock); |
125 | } | 144 | } |
126 | 145 | ||
@@ -341,7 +360,7 @@ static int dlm_do_recovery(struct dlm_ctxt *dlm) | |||
341 | mlog(0, "new master %u died while recovering %u!\n", | 360 | mlog(0, "new master %u died while recovering %u!\n", |
342 | dlm->reco.new_master, dlm->reco.dead_node); | 361 | dlm->reco.new_master, dlm->reco.dead_node); |
343 | /* unset the new_master, leave dead_node */ | 362 | /* unset the new_master, leave dead_node */ |
344 | dlm->reco.new_master = O2NM_INVALID_NODE_NUM; | 363 | dlm_set_reco_master(dlm, O2NM_INVALID_NODE_NUM); |
345 | } | 364 | } |
346 | 365 | ||
347 | /* select a target to recover */ | 366 | /* select a target to recover */ |
@@ -350,14 +369,14 @@ static int dlm_do_recovery(struct dlm_ctxt *dlm) | |||
350 | 369 | ||
351 | bit = find_next_bit (dlm->recovery_map, O2NM_MAX_NODES+1, 0); | 370 | bit = find_next_bit (dlm->recovery_map, O2NM_MAX_NODES+1, 0); |
352 | if (bit >= O2NM_MAX_NODES || bit < 0) | 371 | if (bit >= O2NM_MAX_NODES || bit < 0) |
353 | dlm->reco.dead_node = O2NM_INVALID_NODE_NUM; | 372 | dlm_set_reco_dead_node(dlm, O2NM_INVALID_NODE_NUM); |
354 | else | 373 | else |
355 | dlm->reco.dead_node = bit; | 374 | dlm_set_reco_dead_node(dlm, bit); |
356 | } else if (!test_bit(dlm->reco.dead_node, dlm->recovery_map)) { | 375 | } else if (!test_bit(dlm->reco.dead_node, dlm->recovery_map)) { |
357 | /* BUG? */ | 376 | /* BUG? */ |
358 | mlog(ML_ERROR, "dead_node %u no longer in recovery map!\n", | 377 | mlog(ML_ERROR, "dead_node %u no longer in recovery map!\n", |
359 | dlm->reco.dead_node); | 378 | dlm->reco.dead_node); |
360 | dlm->reco.dead_node = O2NM_INVALID_NODE_NUM; | 379 | dlm_set_reco_dead_node(dlm, O2NM_INVALID_NODE_NUM); |
361 | } | 380 | } |
362 | 381 | ||
363 | if (dlm->reco.dead_node == O2NM_INVALID_NODE_NUM) { | 382 | if (dlm->reco.dead_node == O2NM_INVALID_NODE_NUM) { |
@@ -2089,7 +2108,7 @@ again: | |||
2089 | 2108 | ||
2090 | /* set the new_master to this node */ | 2109 | /* set the new_master to this node */ |
2091 | spin_lock(&dlm->spinlock); | 2110 | spin_lock(&dlm->spinlock); |
2092 | dlm->reco.new_master = dlm->node_num; | 2111 | dlm_set_reco_master(dlm, dlm->node_num); |
2093 | spin_unlock(&dlm->spinlock); | 2112 | spin_unlock(&dlm->spinlock); |
2094 | } | 2113 | } |
2095 | 2114 | ||
@@ -2254,8 +2273,8 @@ int dlm_begin_reco_handler(struct o2net_msg *msg, u32 len, void *data) | |||
2254 | "node %u changing it to %u\n", dlm->name, | 2273 | "node %u changing it to %u\n", dlm->name, |
2255 | dlm->reco.dead_node, br->node_idx, br->dead_node); | 2274 | dlm->reco.dead_node, br->node_idx, br->dead_node); |
2256 | } | 2275 | } |
2257 | dlm->reco.new_master = br->node_idx; | 2276 | dlm_set_reco_master(dlm, br->node_idx); |
2258 | dlm->reco.dead_node = br->dead_node; | 2277 | dlm_set_reco_dead_node(dlm, br->dead_node); |
2259 | if (!test_bit(br->dead_node, dlm->recovery_map)) { | 2278 | if (!test_bit(br->dead_node, dlm->recovery_map)) { |
2260 | mlog(0, "recovery master %u sees %u as dead, but this " | 2279 | mlog(0, "recovery master %u sees %u as dead, but this " |
2261 | "node has not yet. marking %u as dead\n", | 2280 | "node has not yet. marking %u as dead\n", |