Commit ed8625c6 authored by Sunil Mushran's avatar Sunil Mushran

ocfs2/dlm: Cleanup dlm_wait_for_node_death() and dlm_wait_for_node_recovery()

dlm_wait_for_node_death() and dlm_wait_for_node_recovery() needed a facelift.
Signed-off-by: default avatarSunil Mushran <sunil.mushran@oracle.com>
parent e9f0b6a6
...@@ -859,8 +859,8 @@ void dlm_complete_recovery_thread(struct dlm_ctxt *dlm); ...@@ -859,8 +859,8 @@ void dlm_complete_recovery_thread(struct dlm_ctxt *dlm);
void dlm_wait_for_recovery(struct dlm_ctxt *dlm); void dlm_wait_for_recovery(struct dlm_ctxt *dlm);
void dlm_kick_recovery_thread(struct dlm_ctxt *dlm); void dlm_kick_recovery_thread(struct dlm_ctxt *dlm);
int dlm_is_node_dead(struct dlm_ctxt *dlm, u8 node); int dlm_is_node_dead(struct dlm_ctxt *dlm, u8 node);
int dlm_wait_for_node_death(struct dlm_ctxt *dlm, u8 node, int timeout); void dlm_wait_for_node_death(struct dlm_ctxt *dlm, u8 node, int timeout);
int dlm_wait_for_node_recovery(struct dlm_ctxt *dlm, u8 node, int timeout); void dlm_wait_for_node_recovery(struct dlm_ctxt *dlm, u8 node, int timeout);
void dlm_put(struct dlm_ctxt *dlm); void dlm_put(struct dlm_ctxt *dlm);
struct dlm_ctxt *dlm_grab(struct dlm_ctxt *dlm); struct dlm_ctxt *dlm_grab(struct dlm_ctxt *dlm);
......
...@@ -362,40 +362,38 @@ static int dlm_is_node_recovered(struct dlm_ctxt *dlm, u8 node) ...@@ -362,40 +362,38 @@ static int dlm_is_node_recovered(struct dlm_ctxt *dlm, u8 node)
} }
int dlm_wait_for_node_death(struct dlm_ctxt *dlm, u8 node, int timeout) void dlm_wait_for_node_death(struct dlm_ctxt *dlm, u8 node, int timeout)
{ {
if (timeout) { if (dlm_is_node_dead(dlm, node))
mlog(ML_NOTICE, "%s: waiting %dms for notification of " return;
"death of node %u\n", dlm->name, timeout, node);
printk(KERN_NOTICE "o2dlm: Waiting on the death of node %u in "
"domain %s\n", node, dlm->name);
if (timeout)
wait_event_timeout(dlm->dlm_reco_thread_wq, wait_event_timeout(dlm->dlm_reco_thread_wq,
dlm_is_node_dead(dlm, node), dlm_is_node_dead(dlm, node),
msecs_to_jiffies(timeout)); msecs_to_jiffies(timeout));
} else { else
mlog(ML_NOTICE, "%s: waiting indefinitely for notification "
"of death of node %u\n", dlm->name, node);
wait_event(dlm->dlm_reco_thread_wq, wait_event(dlm->dlm_reco_thread_wq,
dlm_is_node_dead(dlm, node)); dlm_is_node_dead(dlm, node));
}
/* for now, return 0 */
return 0;
} }
int dlm_wait_for_node_recovery(struct dlm_ctxt *dlm, u8 node, int timeout) void dlm_wait_for_node_recovery(struct dlm_ctxt *dlm, u8 node, int timeout)
{ {
if (timeout) { if (dlm_is_node_recovered(dlm, node))
mlog(0, "%s: waiting %dms for notification of " return;
"recovery of node %u\n", dlm->name, timeout, node);
printk(KERN_NOTICE "o2dlm: Waiting on the recovery of node %u in "
"domain %s\n", node, dlm->name);
if (timeout)
wait_event_timeout(dlm->dlm_reco_thread_wq, wait_event_timeout(dlm->dlm_reco_thread_wq,
dlm_is_node_recovered(dlm, node), dlm_is_node_recovered(dlm, node),
msecs_to_jiffies(timeout)); msecs_to_jiffies(timeout));
} else { else
mlog(0, "%s: waiting indefinitely for notification "
"of recovery of node %u\n", dlm->name, node);
wait_event(dlm->dlm_reco_thread_wq, wait_event(dlm->dlm_reco_thread_wq,
dlm_is_node_recovered(dlm, node)); dlm_is_node_recovered(dlm, node));
}
/* for now, return 0 */
return 0;
} }
/* callers of the top-level api calls (dlmlock/dlmunlock) should /* callers of the top-level api calls (dlmlock/dlmunlock) should
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment