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

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Sep 3 15:41:39 CDT 2004


Author: mfasheh
Date: 2004-09-03 15:41:38 -0500 (Fri, 03 Sep 2004)
New Revision: 1419

Modified:
   trunk/src/dlm.c
Log:
* fix a bug where we weren't checking extra_lock_flags at the bottom
  of acquire_lock correctly.

* get things in release_lock_full ready for my next patch.



Modified: trunk/src/dlm.c
===================================================================
--- trunk/src/dlm.c	2004-09-02 18:48:57 UTC (rev 1418)
+++ trunk/src/dlm.c	2004-09-03 20:41:38 UTC (rev 1419)
@@ -381,7 +381,7 @@
 skip_lock_write:
 	OCFS_ASSERT(status == 0);
 	lockres->lock_holders++;
-	if (extra_lock_flags == FLAG_FAST_PATH_LOCK 
+	if ((extra_lock_flags & FLAG_FAST_PATH_LOCK)
 	    && ((flags & FLAG_FILE_EXTEND) || (flags & FLAG_FILE_TRUNCATE)))
 		lockres->uncommitted_holders++;
 	LOG_TRACE_ARGS("lockres->lock_holders = %u\n", lockres->lock_holders);
@@ -413,7 +413,7 @@
 	int vote_status = 0;
 	ocfs_lock_res *lockres = GET_INODE_LOCKRES(inode);
 	__u64 lock_id;
-	__u32 num_to_send = num_ident;
+	__u32 num_to_send;
 	ocfs_node_map votemap;
 
 	LOG_ENTRY_ARGS ("(0x%p, %u, %u, 0x%p)\n",
@@ -446,20 +446,26 @@
 		goto finally;
 	}
 
-	OCFS_ASSERT(lockres->uncommitted_holders <= num_ident);
+	OCFS_ASSERT(lockres->uncommitted_holders <= lockres->lock_holders);
 
+	num_to_send = num_ident;
 	/* we don't want to send over a count for any size change
 	 * which includes acquires which we also didn't broadcast. */
 	if ((flags & FLAG_FILE_EXTEND) || (flags & FLAG_FILE_TRUNCATE)) {
+		if (num_ident <= lockres->uncommitted_holders) {
+			/* it breaks the rules to send zero or
+			 * negative lock releases! */
+			num_to_send = 0;
+			lockres->uncommitted_holders -= num_ident;
+			status = 0;
+			goto finally;
+		} 
 		num_to_send -= lockres->uncommitted_holders;
 		lockres->uncommitted_holders = 0;
-		if (!num_to_send) {
-			/* it breaks the rules to send zero lock releases! */
-			status = 0;
-			goto finally;
-		}
 	}
 
+	OCFS_ASSERT(num_to_send);
+
 	ocfs_node_map_dup(osb, &votemap, &osb->publ_map);
 	ocfs_node_map_clear_bit(&votemap, osb->node_num);
 	if (ocfs_node_map_is_empty(&votemap))



More information about the Ocfs2-commits mailing list