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

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue May 17 16:12:36 CDT 2005


Author: khackel
Signed-off-by: mfasheh
Date: 2005-05-17 16:12:34 -0500 (Tue, 17 May 2005)
New Revision: 2261

Modified:
   trunk/fs/ocfs2/dlm/dlmdebug.c
   trunk/fs/ocfs2/dlm/dlmdebug.h
   trunk/fs/ocfs2/dlm/dlmmaster.c
Log:
* changes code in dlm_assert_master_handler to kill the *calling* node when invalid
  mastery cases happen instead of BUGging the local node
* fixes a bug in dlm_wait_for_lock_mastery that would attempt to master a lock even
  if a BLOCK mle exists (needs to block and wait in this case)

Signed-off-by: mfasheh



Modified: trunk/fs/ocfs2/dlm/dlmdebug.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmdebug.c	2005-05-17 21:00:39 UTC (rev 2260)
+++ trunk/fs/ocfs2/dlm/dlmdebug.c	2005-05-17 21:12:34 UTC (rev 2261)
@@ -41,12 +41,12 @@
 #include "dlmdebug.h"
 
 #include "dlmdomain.h"
+#include "dlmdebug.h"
 
 #define MLOG_MASK_PREFIX ML_DLM
 #include "cluster/masklog.h"
 
 static void dlm_dump_all_lock_resources(const char __user *data, int len);
-static void dlm_dump_lock_resources(dlm_ctxt *dlm);
 static void dlm_dump_purge_list(dlm_ctxt *dlm);
 static void dlm_dump_all_purge_lists(const char __user *data, int len);
 static void dlm_trigger_migration(const char __user *data, int len);
@@ -124,7 +124,7 @@
 	spin_unlock(&dlm_domain_lock);
 }
 
-static void dlm_dump_lock_resources(dlm_ctxt *dlm)
+void dlm_dump_lock_resources(dlm_ctxt *dlm)
 {
 	dlm_lock_resource *res;
 	dlm_lock *lock;

Modified: trunk/fs/ocfs2/dlm/dlmdebug.h
===================================================================
--- trunk/fs/ocfs2/dlm/dlmdebug.h	2005-05-17 21:00:39 UTC (rev 2260)
+++ trunk/fs/ocfs2/dlm/dlmdebug.h	2005-05-17 21:12:34 UTC (rev 2261)
@@ -26,5 +26,6 @@
 #define DLMDEBUG_H
 
 void dlm_create_dlm_debug_proc_entry(void);
+void dlm_dump_lock_resources(dlm_ctxt *dlm);
 
 #endif

Modified: trunk/fs/ocfs2/dlm/dlmmaster.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmmaster.c	2005-05-17 21:00:39 UTC (rev 2260)
+++ trunk/fs/ocfs2/dlm/dlmmaster.c	2005-05-17 21:12:34 UTC (rev 2261)
@@ -46,6 +46,7 @@
 
 #include "dlmapi.h"
 #include "dlmcommon.h"
+#include "dlmdebug.h"
 
 #define MLOG_MASK_PREFIX (ML_DLM|ML_DLM_MASTER)
 #include "cluster/masklog.h"
@@ -134,7 +135,8 @@
 
 
 static int dlm_wait_for_lock_mastery(dlm_ctxt *dlm, dlm_lock_resource *res, 
-				     dlm_master_list_entry *mle);
+				     dlm_master_list_entry *mle,
+				     int blocked);
 static int dlm_restart_lock_mastery(dlm_ctxt *dlm, dlm_lock_resource *res,
 				    dlm_master_list_entry *mle);
 static int dlm_add_migration_mle(dlm_ctxt *dlm, 
@@ -693,7 +695,7 @@
 	/* keep going until the response map includes all nodes */
 	ret = -EAGAIN;
 	while (ret == -EAGAIN) {
-		ret = dlm_wait_for_lock_mastery(dlm, res, mle);
+		ret = dlm_wait_for_lock_mastery(dlm, res, mle, blocked);
 		if (ret == -EINVAL) {
 			mlog(ML_ERROR, "some error occurred.  restarting "
 			     "lock mastery!\n");
@@ -719,7 +721,8 @@
 
 
 static int dlm_wait_for_lock_mastery(dlm_ctxt *dlm, dlm_lock_resource *res, 
-				     dlm_master_list_entry *mle)
+				     dlm_master_list_entry *mle,
+				     int blocked)
 {
 	u8 m;
 	int ret = 0, tmpret, bit;
@@ -765,7 +768,7 @@
 	} else {
 		sleep = 1;
 		/* have all nodes responded? */
-		if (voting_done) {
+		if (voting_done && !blocked) {
 			bit = find_next_bit(mle->maybe_map, NM_MAX_NODES, 0);
 			if (dlm->node_num <= bit) {
 				/* my node number is lowest.
@@ -1152,10 +1155,10 @@
 			ret = tmpret;
 			break;
 		} else if (r < 0) {
-			/* nothing returns this yet */
 			/* ok, something horribly messed.  kill thyself. */
 			mlog(ML_ERROR,"during assert master of %.*s to %u, "
 			     "got %d.\n", namelen, lockname, to, r);
+			dlm_dump_lock_resources(dlm);
 			BUG();
 		}
 	}
@@ -1240,7 +1243,7 @@
 					  "%u! (%.*s)\n",
 				       assert->node_idx, res->owner,
 				       namelen, name);
-				BUG();
+				goto kill;
 			}
 		} else if (mle->type != DLM_MLE_MIGRATION) {
 			if (res->owner != DLM_LOCK_RES_OWNER_UNKNOWN) {
@@ -1248,7 +1251,7 @@
 				     "node %u, but %u is the owner! "
 				     "(%.*s)\n", assert->node_idx, 
 				     res->owner, namelen, name);
-				BUG();
+				goto kill;
 			}
 			if (!(res->state & DLM_LOCK_RES_IN_PROGRESS)) {
 				mlog(ML_ERROR, "got assert from %u, but lock "
@@ -1256,7 +1259,7 @@
 				     "in-progress! (%.*s)\n", 
 				     assert->node_idx,
 				     namelen, name);
-				BUG();
+				goto kill;
 			}
 		} else /* mle->type == DLM_MLE_MIGRATION */ {
 			/* should only be getting an assert from new master */
@@ -1266,7 +1269,7 @@
 				     "was %u (%.*s)\n", 
 				     assert->node_idx, mle->new_master,
 				     mle->master, namelen, name);
-				BUG();
+				goto kill;
 			}
 
 		}
@@ -1303,6 +1306,14 @@
 done:
 	dlm_put(dlm);
 	return 0;
+
+kill:
+	/* kill the caller! */
+	spin_unlock(&res->spinlock);
+	spin_unlock(&dlm->spinlock);
+	dlm_dump_lock_resources(dlm);
+	dlm_put(dlm);
+	return -EINVAL;
 }
 
 int dlm_dispatch_assert_master(dlm_ctxt *dlm, dlm_lock_resource *res, 



More information about the Ocfs2-commits mailing list