[Ocfs2-commits] jlbec commits r2290 - in trunk/fs/ocfs2: . dlm

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu May 19 17:31:54 CDT 2005


Author: jlbec
Signed-off-by: mfasheh
Date: 2005-05-19 17:31:52 -0500 (Thu, 19 May 2005)
New Revision: 2290

Modified:
   trunk/fs/ocfs2/dlm/dlmapi.h
   trunk/fs/ocfs2/dlm/dlmdebug.c
   trunk/fs/ocfs2/dlmglue.c
Log:

o Print lockres name when DLM returns error.
o Dump lock state and bug when DLM returns error in __ocfs2_drop_lock.

Signed-off-by: mfasheh



Modified: trunk/fs/ocfs2/dlm/dlmapi.h
===================================================================
--- trunk/fs/ocfs2/dlm/dlmapi.h	2005-05-19 21:39:00 UTC (rev 2289)
+++ trunk/fs/ocfs2/dlm/dlmapi.h	2005-05-19 22:31:52 UTC (rev 2290)
@@ -185,4 +185,6 @@
 
 void dlm_unregister_domain(dlm_ctxt *dlm);
 
+void dlm_print_one_lock(dlm_lock *lockid);
+
 #endif /* DLMAPI_H */

Modified: trunk/fs/ocfs2/dlm/dlmdebug.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmdebug.c	2005-05-19 21:39:00 UTC (rev 2289)
+++ trunk/fs/ocfs2/dlm/dlmdebug.c	2005-05-19 22:31:52 UTC (rev 2290)
@@ -124,11 +124,58 @@
 	spin_unlock(&dlm_domain_lock);
 }
 
+static void dlm_print_one_lock_resource(dlm_lock_resource *res)
+{
+	struct list_head *iter2;
+	dlm_lock *lock;
+
+	printk("lockres: %.*s, owner=%u, state=%u\n", 
+	       res->lockname.len, res->lockname.name, 
+	       res->owner, res->state);
+	spin_lock(&res->spinlock);
+	printk("  granted queue: \n");
+	list_for_each(iter2, &res->granted) {
+		lock = list_entry(iter2, dlm_lock, list);
+		spin_lock(&lock->spinlock);
+		printk("    type=%d, conv=%d, node=%u, " 
+		       "cookie=%"MLFu64"\n", lock->ml.type, 
+		       lock->ml.convert_type, lock->ml.node, 
+		       lock->ml.cookie);
+		spin_unlock(&lock->spinlock);
+	}
+	printk("  converting queue: \n");
+	list_for_each(iter2, &res->converting) {
+		lock = list_entry(iter2, dlm_lock, list);
+		spin_lock(&lock->spinlock);
+		printk("    type=%d, conv=%d, node=%u, " 
+		       "cookie=%"MLFu64"\n", lock->ml.type, 
+		       lock->ml.convert_type, lock->ml.node, 
+		       lock->ml.cookie);
+		spin_unlock(&lock->spinlock);
+	}
+	printk("  blocked queue: \n");
+	list_for_each(iter2, &res->blocked) {
+		lock = list_entry(iter2, dlm_lock, list);
+		spin_lock(&lock->spinlock);
+		printk("    type=%d, conv=%d, node=%u, " 
+		       "cookie=%"MLFu64"\n", lock->ml.type, 
+		       lock->ml.convert_type, lock->ml.node, 
+		       lock->ml.cookie);
+		spin_unlock(&lock->spinlock);
+	}
+	spin_unlock(&res->spinlock);
+}
+
+void dlm_print_one_lock(dlm_lock *lockid)
+{
+	dlm_print_one_lock_resource(lockid->lockres);
+}
+EXPORT_SYMBOL(dlm_print_one_lock);
+
 void dlm_dump_lock_resources(dlm_ctxt *dlm)
 {
 	dlm_lock_resource *res;
-	dlm_lock *lock;
-	struct list_head *iter, *iter2;
+	struct list_head *iter;
 	struct list_head *bucket;
 	int i;
 
@@ -145,41 +192,7 @@
 		bucket = &(dlm->resources[i]);
 		list_for_each(iter, bucket) {
 			res = list_entry(iter, dlm_lock_resource, list);
-			printk("lockres: %.*s, owner=%u, state=%u\n", 
-			       res->lockname.len, res->lockname.name, 
-			       res->owner, res->state);
-			spin_lock(&res->spinlock);
-			printk("  granted queue: \n");
-			list_for_each(iter2, &res->granted) {
-				lock = list_entry(iter2, dlm_lock, list);
-				spin_lock(&lock->spinlock);
-				printk("    type=%d, conv=%d, node=%u, " 
-				       "cookie=%"MLFu64"\n", lock->ml.type, 
-				       lock->ml.convert_type, lock->ml.node, 
-				       lock->ml.cookie);
-				spin_unlock(&lock->spinlock);
-			}
-			printk("  converting queue: \n");
-			list_for_each(iter2, &res->converting) {
-				lock = list_entry(iter2, dlm_lock, list);
-				spin_lock(&lock->spinlock);
-				printk("    type=%d, conv=%d, node=%u, " 
-				       "cookie=%"MLFu64"\n", lock->ml.type, 
-				       lock->ml.convert_type, lock->ml.node, 
-				       lock->ml.cookie);
-				spin_unlock(&lock->spinlock);
-			}
-			printk("  blocked queue: \n");
-			list_for_each(iter2, &res->blocked) {
-				lock = list_entry(iter2, dlm_lock, list);
-				spin_lock(&lock->spinlock);
-				printk("    type=%d, conv=%d, node=%u, " 
-				       "cookie=%"MLFu64"\n", lock->ml.type, 
-				       lock->ml.convert_type, lock->ml.node, 
-				       lock->ml.cookie);
-				spin_unlock(&lock->spinlock);
-			}
-			spin_unlock(&res->spinlock);
+			dlm_print_one_lock_resource(res);
 		}
 	}
 	spin_unlock(&dlm->spinlock);

Modified: trunk/fs/ocfs2/dlmglue.c
===================================================================
--- trunk/fs/ocfs2/dlmglue.c	2005-05-19 21:39:00 UTC (rev 2289)
+++ trunk/fs/ocfs2/dlmglue.c	2005-05-19 22:31:52 UTC (rev 2290)
@@ -821,7 +821,8 @@
 			 lockres,
 			 lockres->l_ops->bast);
 	if (status != DLM_NORMAL) {
-		mlog(ML_ERROR, "Dlm returns %d\n", status);
+		mlog(ML_ERROR, "Dlm returns %d for lock %s\n", status,
+		     lockres->l_name);
 		ret = -ENOENT;
 		ocfs2_recover_from_dlm_error(lockres, 1);
 	}
@@ -1006,7 +1007,9 @@
 			    (status == DLM_NOTQUEUED))
 				ret = -EAGAIN;
 			else {
-				mlog(ML_ERROR, "Dlm returns %d\n", status);
+				mlog(ML_ERROR,
+				     "Dlm returns %d for lock %s\n",
+				     status, lockres->l_name);
 				ret = -ENOENT;
 			}
 			ocfs2_recover_from_dlm_error(lockres, 1);
@@ -1692,7 +1695,8 @@
 	     lockres->l_unlock_action);
 
 	if (status != DLM_NORMAL)
-		mlog(ML_ERROR, "Dlm returns status %d\n", status);
+		mlog(ML_ERROR, "Dlm returns status %d for lock %s\n",
+		     status, lockres->l_name);
 
 	spin_lock(&lockres->l_lock);
 	switch(lockres->l_unlock_action) {
@@ -1714,6 +1718,7 @@
 	mlog_exit_void();
 }
 
+
 /* BEWARE: called with lockres lock, and always drops it. Caller
  * should not be calling us with a busy lock... */
 static int __ocfs2_drop_lock(ocfs_super *osb,
@@ -1751,9 +1756,10 @@
 			   lockres->l_ops->unlock_ast,
 			   lockres);
 	if (status != DLM_NORMAL) {
-		mlog(ML_ERROR, "Dlm returns %d\n", status);
-		ret = -ENOENT;
-		goto bail;
+		mlog(ML_ERROR, "Dlm returns %d for lock %s\n", status,
+		     lockres->l_name);
+		dlm_print_one_lock(lockres->l_lksb.lockid);
+		BUG();
 	}
 	mlog(0, "lock %s, successfull return from dlmunlock\n",
 	     lockres->l_name);
@@ -1894,7 +1900,8 @@
 			 lockres,
 			 lockres->l_ops->bast);
 	if (status != DLM_NORMAL) {
-		mlog(ML_ERROR, "Dlm returns %d\n", status);
+		mlog(ML_ERROR, "Dlm returns %d for lock %s\n", status,
+		     lockres->l_name);
 		ret = -ENOENT;
 		ocfs2_recover_from_dlm_error(lockres, 1);
 		goto bail;
@@ -1942,7 +1949,8 @@
 			lockres->l_unlock_action = OCFS2_UNLOCK_INVALID;
 		spin_unlock(&lockres->l_lock);
 	} else if (status != DLM_NORMAL) {
-		mlog(ML_ERROR, "Dlm returns %d\n", status);
+		mlog(ML_ERROR, "Dlm returns %d for lock %s\n", status,
+		     lockres->l_name);
 		ret = -ENOENT;
 		ocfs2_recover_from_dlm_error(lockres, 0);
 	}



More information about the Ocfs2-commits mailing list