Skip to content

Commit

Permalink
[PATCH] ocfs2: recheck recovery state after getting lock
Browse files Browse the repository at this point in the history
* after successfully taking the $RECOVERY lock in EX mode, recheck to make
  sure that recovery has not already begun or completed on another node

Signed-off-by: Kurt Hackel <kurt.hackel@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
  • Loading branch information
kchackel authored and Mark Fasheh committed Feb 16, 2006
1 parent 90f9dd8 commit 898effa
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions fs/ocfs2/dlm/dlmrecovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -2032,6 +2032,30 @@ static int dlm_pick_recovery_master(struct dlm_ctxt *dlm)
dlm->reco.new_master);
status = -EEXIST;
} else {
status = 0;

/* see if recovery was already finished elsewhere */
spin_lock(&dlm->spinlock);
if (dlm->reco.dead_node == O2NM_INVALID_NODE_NUM) {
status = -EINVAL;
mlog(0, "%s: got reco EX lock, but "
"node got recovered already\n", dlm->name);
if (dlm->reco.new_master != O2NM_INVALID_NODE_NUM) {
mlog(ML_ERROR, "%s: new master is %u "
"but no dead node!\n",
dlm->name, dlm->reco.new_master);
BUG();
}
}
spin_unlock(&dlm->spinlock);
}

/* if this node has actually become the recovery master,
* set the master and send the messages to begin recovery */
if (!status) {
mlog(0, "%s: dead=%u, this=%u, sending "
"begin_reco now\n", dlm->name,
dlm->reco.dead_node, dlm->node_num);
status = dlm_send_begin_reco_message(dlm,
dlm->reco.dead_node);
/* this always succeeds */
Expand Down

0 comments on commit 898effa

Please sign in to comment.