[Ocfs2-commits] khackel commits r2665 - trunk/fs/ocfs2/dlm

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Oct 31 13:02:54 CST 2005


Author: khackel
Signed-off-by: jlbec
Signed-off-by: smushran
Date: 2005-10-31 13:02:53 -0600 (Mon, 31 Oct 2005)
New Revision: 2665

Modified:
   trunk/fs/ocfs2/dlm/dlmmaster.c
Log:
- fixes bug 596
- after fixing 569, nodes not involved in lock mastery would BUG when the proper master would assert.  fixes this.
- also fixes a refcount problem in the assert master handler

Signed-off-by: jlbec
Signed-off-by: smushran  



Modified: trunk/fs/ocfs2/dlm/dlmmaster.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmmaster.c	2005-10-27 22:53:58 UTC (rev 2664)
+++ trunk/fs/ocfs2/dlm/dlmmaster.c	2005-10-31 19:02:53 UTC (rev 2665)
@@ -1504,7 +1504,7 @@
 	struct dlm_ctxt *dlm = data;
 	struct dlm_master_list_entry *mle = NULL;
 	struct dlm_assert_master *assert = (struct dlm_assert_master *)msg->buf;
-	struct dlm_lock_resource *res;
+	struct dlm_lock_resource *res = NULL;
 	char *name;
 	unsigned int namelen;
 	u32 flags;
@@ -1529,25 +1529,32 @@
 	/* find the MLE */
 	spin_lock(&dlm->master_lock);
 	if (!dlm_find_mle(dlm, &mle, name, namelen)) {
+		/* not an error, could be master just re-asserting */
 		mlog(0, "just got an assert_master from %u, but no "
 		     "MLE for it! (%.*s)\n", assert->node_idx,
 		     namelen, name);
 	} else {
 		int bit = find_next_bit (mle->maybe_map, O2NM_MAX_NODES, 0);
 		if (bit >= O2NM_MAX_NODES) {
+			/* not necessarily an error, though less likely.
+			 * could be master just re-asserting. */
 			mlog(ML_ERROR, "no bits set in the maybe_map, but %u "
 			     "is asserting! (%.*s)\n", assert->node_idx,
 			     namelen, name);
-			BUG();
 		} else if (bit != assert->node_idx) {
 			if (flags & DLM_ASSERT_MASTER_MLE_CLEANUP) {
 				mlog(0, "master %u was found, %u should "
 				     "back off\n", assert->node_idx, bit);
 			} else {
-				mlog(ML_ERROR, "expected %u to be the master, "
-				     "but %u is asserting! (%.*s)\n", bit,
-				     assert->node_idx, namelen, name);
-				BUG();
+				/* with the fix for bug 569, a higher node
+				 * number winning the mastery will respond
+				 * YES to mastery requests, but this node
+				 * had no way of knowing.  let it pass. */
+				mlog(ML_ERROR, "%u is the lowest node, "
+				     "%u is asserting. (%.*s)  %u must "
+				     "have begun after %u won.\n", bit,
+				     assert->node_idx, namelen, name, bit,
+				     assert->node_idx);
 			}
 		}
 	}
@@ -1558,7 +1565,11 @@
 	res = __dlm_lookup_lockres(dlm, name, namelen);
 	if (res) {
 		spin_lock(&res->spinlock);
-		BUG_ON(res->state & DLM_LOCK_RES_RECOVERING);
+		if (res->state & DLM_LOCK_RES_RECOVERING)  {
+			mlog(ML_ERROR, "%u asserting but %.*s is "
+			     "RECOVERING!\n", assert->node_idx, namelen, name);
+			goto kill;
+		}
 		if (!mle) {
 			if (res->owner != assert->node_idx) {
 				mlog(ML_ERROR, "assert_master from "
@@ -1645,6 +1656,8 @@
 	}
 
 done:
+	if (res)
+		dlm_lockres_put(res);
 	dlm_put(dlm);
 	return 0;
 
@@ -1652,6 +1665,7 @@
 	/* kill the caller! */
 	spin_unlock(&res->spinlock);
 	spin_unlock(&dlm->spinlock);
+	dlm_lockres_put(res);
 	mlog(ML_ERROR, "Bad message received from another node.  Dumping state "
 	     "and killing the other node now!  This node is OK and can continue.\n");
 	dlm_dump_lock_resources(dlm);



More information about the Ocfs2-commits mailing list