diff options
Diffstat (limited to 'fs/ocfs2/dlm')
-rw-r--r-- | fs/ocfs2/dlm/dlmcommon.h | 1 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmmaster.c | 3 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmrecovery.c | 30 |
3 files changed, 34 insertions, 0 deletions
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h index 829cc3948804..9bea5c6ef9bf 100644 --- a/fs/ocfs2/dlm/dlmcommon.h +++ b/fs/ocfs2/dlm/dlmcommon.h | |||
@@ -710,6 +710,7 @@ void dlm_wait_for_recovery(struct dlm_ctxt *dlm); | |||
710 | void dlm_kick_recovery_thread(struct dlm_ctxt *dlm); | 710 | void dlm_kick_recovery_thread(struct dlm_ctxt *dlm); |
711 | int dlm_is_node_dead(struct dlm_ctxt *dlm, u8 node); | 711 | int dlm_is_node_dead(struct dlm_ctxt *dlm, u8 node); |
712 | int dlm_wait_for_node_death(struct dlm_ctxt *dlm, u8 node, int timeout); | 712 | int dlm_wait_for_node_death(struct dlm_ctxt *dlm, u8 node, int timeout); |
713 | int dlm_wait_for_node_recovery(struct dlm_ctxt *dlm, u8 node, int timeout); | ||
713 | 714 | ||
714 | void dlm_put(struct dlm_ctxt *dlm); | 715 | void dlm_put(struct dlm_ctxt *dlm); |
715 | struct dlm_ctxt *dlm_grab(struct dlm_ctxt *dlm); | 716 | struct dlm_ctxt *dlm_grab(struct dlm_ctxt *dlm); |
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index 78ba77bf3a77..ed1601d1831c 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
@@ -899,6 +899,9 @@ redo_request: | |||
899 | } else | 899 | } else |
900 | wait_on_recovery = 0; | 900 | wait_on_recovery = 0; |
901 | spin_unlock(&dlm->spinlock); | 901 | spin_unlock(&dlm->spinlock); |
902 | |||
903 | if (wait_on_recovery) | ||
904 | dlm_wait_for_node_recovery(dlm, bit, 10000); | ||
902 | } | 905 | } |
903 | 906 | ||
904 | /* must wait for lock to be mastered elsewhere */ | 907 | /* must wait for lock to be mastered elsewhere */ |
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index c699a450b0f2..b03fecab299d 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c | |||
@@ -343,6 +343,18 @@ int dlm_is_node_dead(struct dlm_ctxt *dlm, u8 node) | |||
343 | return dead; | 343 | return dead; |
344 | } | 344 | } |
345 | 345 | ||
346 | /* returns true if node is no longer in the domain | ||
347 | * could be dead or just not joined */ | ||
348 | int dlm_is_node_recovered(struct dlm_ctxt *dlm, u8 node) | ||
349 | { | ||
350 | int recovered; | ||
351 | spin_lock(&dlm->spinlock); | ||
352 | recovered = !test_bit(node, dlm->recovery_map); | ||
353 | spin_unlock(&dlm->spinlock); | ||
354 | return recovered; | ||
355 | } | ||
356 | |||
357 | |||
346 | int dlm_wait_for_node_death(struct dlm_ctxt *dlm, u8 node, int timeout) | 358 | int dlm_wait_for_node_death(struct dlm_ctxt *dlm, u8 node, int timeout) |
347 | { | 359 | { |
348 | if (timeout) { | 360 | if (timeout) { |
@@ -361,6 +373,24 @@ int dlm_wait_for_node_death(struct dlm_ctxt *dlm, u8 node, int timeout) | |||
361 | return 0; | 373 | return 0; |
362 | } | 374 | } |
363 | 375 | ||
376 | int dlm_wait_for_node_recovery(struct dlm_ctxt *dlm, u8 node, int timeout) | ||
377 | { | ||
378 | if (timeout) { | ||
379 | mlog(0, "%s: waiting %dms for notification of " | ||
380 | "recovery of node %u\n", dlm->name, timeout, node); | ||
381 | wait_event_timeout(dlm->dlm_reco_thread_wq, | ||
382 | dlm_is_node_recovered(dlm, node), | ||
383 | msecs_to_jiffies(timeout)); | ||
384 | } else { | ||
385 | mlog(0, "%s: waiting indefinitely for notification " | ||
386 | "of recovery of node %u\n", dlm->name, node); | ||
387 | wait_event(dlm->dlm_reco_thread_wq, | ||
388 | dlm_is_node_recovered(dlm, node)); | ||
389 | } | ||
390 | /* for now, return 0 */ | ||
391 | return 0; | ||
392 | } | ||
393 | |||
364 | /* callers of the top-level api calls (dlmlock/dlmunlock) should | 394 | /* callers of the top-level api calls (dlmlock/dlmunlock) should |
365 | * block on the dlm->reco.event when recovery is in progress. | 395 | * block on the dlm->reco.event when recovery is in progress. |
366 | * the dlm recovery thread will set this state when it begins | 396 | * the dlm recovery thread will set this state when it begins |