[Ocfs2-commits] mfasheh commits r1749 - trunk/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Jan 7 20:41:52 CST 2005


Author: mfasheh
Date: 2005-01-07 20:41:50 -0600 (Fri, 07 Jan 2005)
New Revision: 1749

Modified:
   trunk/src/dlmglue.c
Log:
* fix an invalid status return bug from ocfs2_meta_lock_update
  
* add a wake_up() call to the end of the bast functions. I'm actually not
  sure this is necessary so it may go away in a future commit.

* add some more logging, clean up what's already there



Modified: trunk/src/dlmglue.c
===================================================================
--- trunk/src/dlmglue.c	2005-01-07 23:39:44 UTC (rev 1748)
+++ trunk/src/dlmglue.c	2005-01-08 02:41:50 UTC (rev 1749)
@@ -55,6 +55,16 @@
 
 #define OCFS_DEBUG_CONTEXT    OCFS_DEBUG_CONTEXT_DLMGLUE
 
+#ifdef VERBOSE_LOCKING_TRACE
+#define dprintk(str, args...)						      \
+	printk("(%d) %s:%d " str, current->pid, __FUNCTION__, __LINE__, ##args)
+#define dprintk0(str)							      \
+	printk("(%d) %s:%d " str, current->pid, __FUNCTION__, __LINE__)
+#else
+#define dprintk(str, args...)
+#define dprintk0(str)
+#endif
+
 /* lock ids are made up in the following manner:
  * name[0]     --> type
  * name[1-6]   --> 6 pad characters, reserved for now
@@ -286,9 +296,8 @@
 
 	OCFS_ASSERT(len = (OCFS2_LOCK_ID_MAX_LEN - 1));
 
-#ifdef VERBOSE_LOCKING_TRACE
-	printk("built lock resource with name: %s\n", name);
-#endif
+	dprintk("built lock resource with name: %s\n", name);
+
 	*ret = name;
 bail:
 	LOG_EXIT();
@@ -546,18 +555,18 @@
 	inode = ocfs2_lock_res_inode(lockres);
 	osb = OCFS2_SB(inode->i_sb);
 
-#ifdef VERBOSE_LOCKING_TRACE
-	printk("(%u) AST fired for inode %llu, l_action = %u, type = %s\n",
-	       current->pid, OCFS_I(inode)->ip_blkno, lockres->l_action,
-	       (lockres->l_type == OCFS_TYPE_META) ? "Meta" : "Data");
-#endif
+	dprintk("AST fired for inode %llu, l_action = %u, type = %s\n",
+		OCFS_I(inode)->ip_blkno, lockres->l_action,
+		(lockres->l_type == OCFS_TYPE_META) ? "Meta" : "Data");
+
 	OCFS_ASSERT(ocfs2_is_inode_lock(lockres));
 
 	spin_lock(&lockres->l_lock);
 	lksb = &(lockres->l_lksb);
 	if (lksb->status != DLM_NORMAL) {
-		printk("ocfs2_inode_ast_func: lksb status value of %u on "
-		       "inode %llu\n", lksb->status, OCFS_I(inode)->ip_blkno);
+		LOG_ERROR_ARGS("ocfs2_inode_ast_func: lksb status value of %u "
+			       "on inode %llu\n", lksb->status,
+			       OCFS_I(inode)->ip_blkno);
 		spin_unlock(&lockres->l_lock);
 		LOG_EXIT();
 		return;
@@ -622,16 +631,18 @@
 	inode = ocfs2_lock_res_inode(lockres);
 	osb = OCFS2_SB(inode->i_sb);
 
-#ifdef VERBOSE_LOCKING_TRACE
-	printk("(%u) BAST fired for inode %llu, blocking = %d, level = %d "
-	       "type = %s\n", current->pid, OCFS_I(inode)->ip_blkno, level,
+	dprintk("BAST fired for inode %llu, blocking = %d, level = %d "
+	       "type = %s\n", OCFS_I(inode)->ip_blkno, level,
 	       lockres->l_level, 
 	       (lockres->l_type == OCFS_TYPE_META) ? "Meta" : "Data");
-#endif
+
 	ocfs2_generic_handle_bast(lockres, level);
 
 	ocfs2_schedule_blocked_inode_lock(inode, lockres);
 	ocfs2_kick_vote_thread(osb);
+
+	/* TODO: Is a wake_up call here really necessary? */
+	wake_up(&lockres->l_event);
 	LOG_EXIT();
 }
 
@@ -642,16 +653,14 @@
 
 	LOG_ENTRY();
 
-#ifdef VERBOSE_LOCKING_TRACE
-	printk("Superblock AST fired\n");
-#endif
+	dprintk("Superblock AST fired\n");
+
 	OCFS_ASSERT(ocfs2_is_super_lock(lockres));
 
 	spin_lock(&lockres->l_lock);
 	lksb = &(lockres->l_lksb);
 	if (lksb->status != DLM_NORMAL) {
-		printk("ocfs2_super_ast_func: lksb status value of %u!\n",
-		       lksb->status);
+		LOG_ERROR_ARGS("lksb status value of %u!\n", lksb->status);
 		spin_unlock(&lockres->l_lock);
 		return;
 	}
@@ -686,14 +695,14 @@
 	LOG_ENTRY();
        	osb = ocfs2_lock_res_super(lockres);
 
-#ifdef VERBOSE_LOCKING_TRACE
-	printk("Superblock BAST fired\n");
-#endif
+	dprintk("Superblock BAST fired\n");
+
 	ocfs2_generic_handle_bast(lockres, level);
 
 	ocfs2_schedule_blocked_lock(osb, lockres);
 	ocfs2_kick_vote_thread(osb);
 
+	wake_up(&lockres->l_event);
 	LOG_EXIT();
 }
 
@@ -721,10 +730,8 @@
 
 	LOG_ENTRY();
 
-#ifdef VERBOSE_LOCKING_TRACE
-	printk("(%u) ocfs2_lock_create: lock %s, level = %d, flags = %d\n",
-	       current->pid, lockres->l_name, level, flags);
-#endif
+	dprintk("lock %s, level = %d, flags = %d\n", lockres->l_name, level, 
+		flags);
 
 	spin_lock(&lockres->l_lock);
 	if (lockres->l_flags & OCFS2_LOCK_ATTACHED) {
@@ -751,6 +758,8 @@
 		ocfs2_recover_from_dlm_error(lockres, 1);
 	}
 
+	dprintk("lock %s, successfull return from dlmlock\n", lockres->l_name);
+
 bail:
 	LOG_EXIT_STATUS(ret);
 	return ret;
@@ -868,6 +877,9 @@
 		OCFS_ASSERT(level != LKM_IVMODE);
 		OCFS_ASSERT(level != LKM_NLMODE);
 
+		dprintk("lock %s, convert from %d to level = %d\n",
+			lockres->l_name, lockres->l_level, level);
+
 		/* call dlm_lock to upgrade lock now */
 		status = dlmlock(osb->dlm,
 				 level,
@@ -889,6 +901,9 @@
 			goto bail;
 		}
 
+		dprintk("lock %s, successfull return from dlmlock\n",
+			lockres->l_name);
+
 		ocfs2_wait_on_busy_lock(lockres);
 		goto again;
 	}
@@ -979,11 +994,8 @@
 
 	LOG_ENTRY();
 
-#ifdef VERBOSE_LOCKING_TRACE
-	printk("ocfs2: (%u) inode %llu, take %s DATA lock\n",
-	       current->pid, OCFS_I(inode)->ip_blkno,
-	       write ? "EXMODE" : "PRMODE");
-#endif
+	dprintk("inode %llu, take %s DATA lock\n", OCFS_I(inode)->ip_blkno,
+		write ? "EXMODE" : "PRMODE");
 
 	lockres = &OCFS_I(inode)->ip_data_lockres;
 
@@ -1036,11 +1048,8 @@
 
 	LOG_ENTRY();
 
-#ifdef VERBOSE_LOCKING_TRACE
-	printk("ocfs2: (%u) inode %llu drop %s DATA lock\n",
-	       current->pid, OCFS_I(inode)->ip_blkno, 
+	dprintk("inode %llu drop %s DATA lock\n", OCFS_I(inode)->ip_blkno, 
 	       write ? "EXMODE" : "PRMODE");
-#endif
 
 	ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level);
 
@@ -1097,6 +1106,14 @@
 
 	LOG_ENTRY();
 
+	dprintk("seq %u, trunc clusters %u, iclusters %u\n",
+		lvb->lvb.lvb_seq, lvb->lvb_trunc_clusters, lvb->lvb_iclusters);
+	dprintk("uid %u, gid %u, isize %llu, mode 0x%x\n",
+		lvb->lvb_iuid, lvb->lvb_igid, lvb->lvb_isize, lvb->lvb_imode);
+	dprintk("nlink %u, atime %llx, ctime %llx, mtime %llx\n",
+	       lvb->lvb_inlink, lvb->lvb_iatime, lvb->lvb_ictime,
+		lvb->lvb_imtime);
+
 	/* We're safe here without the lockres lock... */
 	spin_lock(&oip->ip_lock);
 	oip->ip_clusters = lvb->lvb_iclusters;
@@ -1222,7 +1239,8 @@
 static int ocfs2_meta_lock_update(struct inode *inode,
 				  struct buffer_head **bh)
 {
-	int status;
+	int status = 0;
+	int needs_refresh;
 	u32 trustable_clusters = 0;
 	ocfs2_lock_res *lockres;
 	ocfs2_dinode *fe;
@@ -1231,10 +1249,11 @@
 
 	lockres = &OCFS_I(inode)->ip_meta_lockres;
 
-	status = ocfs2_should_refresh_lock_res(lockres);
-	if (!status)
+	needs_refresh = ocfs2_should_refresh_lock_res(lockres);
+	if (!needs_refresh)
 		goto bail;
-	if (status < 0) {
+	if (needs_refresh < 0) {
+		status = needs_refresh;
 		if (status != -EINTR)
 			LOG_ERROR_STATUS(status);
 		goto bail;
@@ -1270,10 +1289,8 @@
 		ocfs_refresh_inode(inode, fe);
 	}
 
-#ifdef VERBOSE_LOCKING_TRACE
-	printk("inode %llu, I can only trust %u clusters\n",
+	dprintk("inode %llu, I can only trust %u clusters\n",
 	       OCFS_I(inode)->ip_blkno, trustable_clusters);
-#endif
 
 	ocfs2_extent_map_trunc(inode, trustable_clusters);
 
@@ -1304,11 +1321,8 @@
 
 	LOG_ENTRY();
 
-#ifdef VERBOSE_LOCKING_TRACE
-	printk("ocfs2: (%u) inode %llu, take %s META lock\n",
-	       current->pid, OCFS_I(inode)->ip_blkno,
-	       ex ? "EXMODE" : "PRMODE");
-#endif
+	dprintk("inode %llu, take %s META lock\n", OCFS_I(inode)->ip_blkno,
+		ex ? "EXMODE" : "PRMODE");
 
 	if (!(flags & OCFS2_META_LOCK_RECOVERY)) {
 		status = ocfs2_wait_on_recovery(osb);
@@ -1375,11 +1389,8 @@
 
 	LOG_ENTRY();
 
-#ifdef VERBOSE_LOCKING_TRACE
-	printk("ocfs2: (%u) inode %llu drop %s META lock\n",
-	       current->pid, OCFS_I(inode)->ip_blkno,
-	       ex ? "EXMODE" : "PRMODE");
-#endif
+	dprintk("inode %llu drop %s META lock\n", OCFS_I(inode)->ip_blkno,
+		ex ? "EXMODE" : "PRMODE");
 
 	ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level);
 	LOG_EXIT();
@@ -1511,6 +1522,9 @@
 
 	LOG_ENTRY();
 
+	dprintk("UNLOCK AST called on lock %s, action = %d\n", lockres->l_name,
+		lockres->l_unlock_action);
+
 	if (status != DLM_NORMAL)
 		LOG_ERROR_ARGS("Dlm returns status %d\n", status);
 
@@ -1542,9 +1556,11 @@
 	dlm_status status;
 
 	if (lockres->l_flags & OCFS2_LOCK_BUSY)
-		printk("ocfs2: destroying busy lock!\n");
+		printk("ocfs2: destroying busy lock! (%s)\n",
+		       lockres->l_name);
 	if (lockres->l_flags & OCFS2_LOCK_BLOCKED)
-		printk("ocfs2: destroying blocked lock!\n");
+		printk("ocfs2: destroying blocked lock! (%s)\n",
+		       lockres->l_name);
 
 	if (!(lockres->l_flags & OCFS2_LOCK_ATTACHED)) {
 		spin_unlock(&lockres->l_lock);
@@ -1562,6 +1578,8 @@
 	lockres->l_unlock_action = OCFS2_UNLOCK_DROP_LOCK;
 	spin_unlock(&lockres->l_lock);
 
+	dprintk("lock %s\n", lockres->l_name);
+
 	status = dlmunlock(osb->dlm,
 			   &lockres->l_lksb,
 			   LKM_VALBLK,
@@ -1573,6 +1591,9 @@
 		goto bail;
 	}
 
+	dprintk("lock %s, successfull return from dlmunlock\n",
+		lockres->l_name);
+
 	ocfs2_wait_on_busy_lock(lockres);
 	if (signal_pending(current)) {
 		printk("ocfs2_drop_lock: Signal caught!\n");
@@ -1651,11 +1672,8 @@
 		BUG();
 	}
 
-#ifdef VERBOSE_LOCKING_TRACE
-	printk("(%u) __ocfs2_downconvert_lock: lock %s, new_level = %d,"
-	       "l_blocking = %d, lvb = %d\n", current->pid, lockres->l_name,
-	       new_level, lockres->l_blocking, lvb);
-#endif
+	dprintk("lock %s, new_level = %d, l_blocking = %d, lvb = %d\n",
+		lockres->l_name, new_level, lockres->l_blocking, lvb);
 
 	lockres->l_action = OCFS2_AST_DOWNCONVERT;
 	lockres->l_requested = new_level;
@@ -1693,10 +1711,7 @@
 
 	LOG_ENTRY();
 
-#ifdef VERBOSE_LOCKING_TRACE
-	printk("(%u) __ocfs2_cancel_convert: lock %s\n", current->pid,
-	       lockres->l_name);
-#endif
+	dprintk("lock %s\n", lockres->l_name);
 
 	/* were we in a convert when we got the bast fire? */
 	OCFS_ASSERT(lockres->l_action == OCFS2_AST_CONVERT ||
@@ -1727,6 +1742,8 @@
 		ocfs2_recover_from_dlm_error(lockres, 0);
 	}
 
+	dprintk("lock %s return from dlmunlock\n", lockres->l_name);
+
 	LOG_EXIT_STATUS(status);
 	return status;
 }
@@ -1931,10 +1948,7 @@
 	inode = ocfs2_lock_res_inode(lockres);
 	osb = OCFS2_SB(inode->i_sb);
 
-#ifdef VERBOSE_LOCKING_TRACE
-	printk("(%u) ocfs2_unblock_data: unblock inode %llu\n",
-	       current->pid, OCFS_I(inode)->ip_blkno);
-#endif
+	dprintk("unblock inode %llu\n", OCFS_I(inode)->ip_blkno);
 
 	status = ocfs2_generic_unblock_lock(osb,
 					    lockres,
@@ -1943,10 +1957,8 @@
 	if (status < 0)
 		LOG_ERROR_STATUS(status);
 
-#ifdef VERBOSE_LOCKING_TRACE
-	printk("(%u) ocfs2_unblock_data: inode %llu, requeue = %d\n",
-	       current->pid, OCFS_I(inode)->ip_blkno, *requeue);
-#endif
+	dprintk("inode %llu, requeue = %d\n", OCFS_I(inode)->ip_blkno,
+		*requeue);
 
 	/* because of inode ref counting, we never want to propagate
 	 * up requeue requests for inode locks. Instead we do it
@@ -1972,19 +1984,14 @@
 
        	inode = ocfs2_lock_res_inode(lockres);
 
-#ifdef VERBOSE_LOCKING_TRACE
-	printk("(%u) ocfs2_unblock_meta: unblock inode %llu\n",
-	       current->pid, OCFS_I(inode)->ip_blkno);
-#endif
+	dprintk("unblock inode %llu\n", OCFS_I(inode)->ip_blkno);
 
 	status = ocfs2_do_unblock_meta(inode, requeue);
 	if (status < 0)
 		LOG_ERROR_STATUS(status);
 
-#ifdef VERBOSE_LOCKING_TRACE
-	printk("(%u) ocfs2_unblock_meta: inode %llu, requeue = %d\n",
-	       current->pid, OCFS_I(inode)->ip_blkno, *requeue);
-#endif
+	dprintk("inode %llu, requeue = %d\n", OCFS_I(inode)->ip_blkno,
+		*requeue);
 
 	/* if you're confused by this, see the comment in
 	 * ocfs2_unblock_data */
@@ -2031,10 +2038,7 @@
 	OCFS_ASSERT(lockres->l_ops);
 	OCFS_ASSERT(lockres->l_ops->unblock);
 
-#ifdef VERBOSE_LOCKING_TRACE
-	printk("(%u) ocfs2_process_blocked_lock: lockres %s blocked.\n",
-	       current->pid, lockres->l_name);
-#endif
+	dprintk("lockres %s blocked.\n", lockres->l_name);
 
 	status = lockres->l_ops->unblock(lockres, &requeue);
 	if (status < 0)
@@ -2043,10 +2047,8 @@
 	if (requeue)
 		ocfs2_schedule_blocked_lock(osb, lockres);
 
-#ifdef VERBOSE_LOCKING_TRACE
-	printk("(%u) ocfs2_process_blocked_lock: lockres %s, requeue = %s.\n",
-	       current->pid, lockres->l_name, requeue ? "yes" : "no");
-#endif
+	dprintk("lockres %s, requeue = %s.\n", lockres->l_name,
+		requeue ? "yes" : "no");
 
 	LOG_EXIT();
 }



More information about the Ocfs2-commits mailing list