[Ocfs2-commits] mfasheh commits r1610 - branches/dlm-glue/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Nov 1 16:08:23 CST 2004


Author: mfasheh
Date: 2004-11-01 16:08:21 -0600 (Mon, 01 Nov 2004)
New Revision: 1610

Modified:
   branches/dlm-glue/src/dlmglue.c
Log:
* allow lock requests to continue on blocked locks if the mode we're
  asking for is compatible with the mode we're looking to downconvert
  to.



Modified: branches/dlm-glue/src/dlmglue.c
===================================================================
--- branches/dlm-glue/src/dlmglue.c	2004-11-01 21:50:16 UTC (rev 1609)
+++ branches/dlm-glue/src/dlmglue.c	2004-11-01 22:08:21 UTC (rev 1610)
@@ -122,6 +122,8 @@
 			     ocfs2_lock *lock,
 			     int level,
 			     int flags);
+static inline int ocfs2_may_continue_on_blocked_lock(ocfs2_lock *lock,
+						     int wanted);
 static int ocfs2_cluster_lock(struct inode *inode, 
 			      ocfs2_lock *lock, 
 			      int level);
@@ -579,6 +581,17 @@
 							lock,
 							OCFS2_LOCK_REFRESHING));}
 
+/* predict what lock level we'll be dropping down to on behalf
+ * of another node, and return true if the currently wanted
+ * level will be compatible with it. */
+static inline int ocfs2_may_continue_on_blocked_lock(ocfs2_lock *lock,
+						     int wanted)
+{
+	OCFS_ASSERT(lock->l_flags & OCFS2_LOCK_BLOCKED);
+
+	return wanted <= ocfs2_highest_compat_lock_level(lock->l_blocking);
+}
+
 static int ocfs2_cluster_lock(struct inode *inode, 
 			      ocfs2_lock *lock, 
 			      int level)
@@ -617,7 +630,8 @@
 		goto again;
 	}
 
-	if (lock->l_flags & OCFS2_LOCK_BLOCKED) {
+	if (lock->l_flags & OCFS2_LOCK_BLOCKED &&
+	    !ocfs2_may_continue_on_blocked_lock) {
 		/* is the lock is currently blocked on behalf of
 		 * another node */
 		spin_unlock(&lockres->lr_lock);



More information about the Ocfs2-commits mailing list