[Ocfs2-commits] smushran commits r2894 - branches/ocfs2-1.2/fs/ocfs2/dlm
svn-commits@oss.oracle.com
svn-commits at oss.oracle.com
Thu Apr 20 13:21:09 CDT 2006
Author: smushran
Signed-off-by: mfasheh
Signed-off-by: khackel
Date: 2006-04-20 13:21:07 -0500 (Thu, 20 Apr 2006)
New Revision: 2894
Modified:
branches/ocfs2-1.2/fs/ocfs2/dlm/dlmcommon.h
branches/ocfs2-1.2/fs/ocfs2/dlm/dlmmaster.c
branches/ocfs2-1.2/fs/ocfs2/dlm/dlmrecovery.c
Log:
Wait for any nodes to be recovered when starting mastery.
Signed-off-by: mfasheh
Signed-off-by: khackel
Modified: branches/ocfs2-1.2/fs/ocfs2/dlm/dlmcommon.h
===================================================================
--- branches/ocfs2-1.2/fs/ocfs2/dlm/dlmcommon.h 2006-04-20 18:10:28 UTC (rev 2893)
+++ branches/ocfs2-1.2/fs/ocfs2/dlm/dlmcommon.h 2006-04-20 18:21:07 UTC (rev 2894)
@@ -700,6 +700,7 @@
void dlm_kick_recovery_thread(struct dlm_ctxt *dlm);
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);
+int dlm_wait_for_node_recovery(struct dlm_ctxt *dlm, u8 node, int timeout);
void dlm_get(struct dlm_ctxt *dlm);
void dlm_put(struct dlm_ctxt *dlm);
Modified: branches/ocfs2-1.2/fs/ocfs2/dlm/dlmmaster.c
===================================================================
--- branches/ocfs2-1.2/fs/ocfs2/dlm/dlmmaster.c 2006-04-20 18:10:28 UTC (rev 2893)
+++ branches/ocfs2-1.2/fs/ocfs2/dlm/dlmmaster.c 2006-04-20 18:21:07 UTC (rev 2894)
@@ -897,6 +897,9 @@
} else
wait_on_recovery = 0;
spin_unlock(&dlm->spinlock);
+
+ if (wait_on_recovery)
+ dlm_wait_for_node_recovery(dlm, bit, 10000);
}
/* must wait for lock to be mastered elsewhere */
Modified: branches/ocfs2-1.2/fs/ocfs2/dlm/dlmrecovery.c
===================================================================
--- branches/ocfs2-1.2/fs/ocfs2/dlm/dlmrecovery.c 2006-04-20 18:10:28 UTC (rev 2893)
+++ branches/ocfs2-1.2/fs/ocfs2/dlm/dlmrecovery.c 2006-04-20 18:21:07 UTC (rev 2894)
@@ -343,6 +343,18 @@
return dead;
}
+/* returns true if node is no longer in the domain
+ * could be dead or just not joined */
+int dlm_is_node_recovered(struct dlm_ctxt *dlm, u8 node)
+{
+ int recovered;
+ spin_lock(&dlm->spinlock);
+ recovered = !test_bit(node, dlm->recovery_map);
+ spin_unlock(&dlm->spinlock);
+ return recovered;
+}
+
+
int dlm_wait_for_node_death(struct dlm_ctxt *dlm, u8 node, int timeout)
{
if (timeout) {
@@ -361,6 +373,24 @@
return 0;
}
+int dlm_wait_for_node_recovery(struct dlm_ctxt *dlm, u8 node, int timeout)
+{
+ if (timeout) {
+ mlog(0, "%s: waiting %dms for notification of "
+ "recovery of node %u\n", dlm->name, timeout, node);
+ wait_event_timeout(dlm->dlm_reco_thread_wq,
+ dlm_is_node_recovered(dlm, node),
+ msecs_to_jiffies(timeout));
+ } else {
+ mlog(0, "%s: waiting indefinitely for notification "
+ "of recovery of node %u\n", dlm->name, node);
+ wait_event(dlm->dlm_reco_thread_wq,
+ dlm_is_node_recovered(dlm, node));
+ }
+ /* for now, return 0 */
+ return 0;
+}
+
/* callers of the top-level api calls (dlmlock/dlmunlock) should
* block on the dlm->reco.event when recovery is in progress.
* the dlm recovery thread will set this state when it begins
More information about the Ocfs2-commits
mailing list