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

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Sep 9 16:04:43 CDT 2004


Author: mfasheh
Date: 2004-09-09 16:04:42 -0500 (Thu, 09 Sep 2004)
New Revision: 1446

Modified:
   trunk/src/dlm.c
Log:
* just always set a bit rather than testing if it's not set and then
  setting it.

* fix a read lock in release_lock which needs to be a write lock.



Modified: trunk/src/dlm.c
===================================================================
--- trunk/src/dlm.c	2004-09-09 20:46:27 UTC (rev 1445)
+++ trunk/src/dlm.c	2004-09-09 21:04:42 UTC (rev 1446)
@@ -275,13 +275,11 @@
 			/* THIS node will see it as readonly, but OTHER
 			 * nodes will have to wait until lock_holders drops 
 			 * to 0 (to finish journal flush on this inode) */
-			if (!test_bit(LOCK_STATE_READONLY, &lockres->readonly_state)) {
 #ifdef VERBOSE_LOCKING_TRACE
-				printk("acquire_lock: lockid %llu, setting readonly\n",
-				       lock_id);
+			printk("acquire_lock: lockid %llu, setting readonly\n",
+			       lock_id);
 #endif
-				set_bit(LOCK_STATE_READONLY, &lockres->readonly_state);
-			}
+			set_bit(LOCK_STATE_READONLY, &lockres->readonly_state);
 			ocfs_release_lockres_write (inode);
 			goto finally;
 		}
@@ -436,7 +434,6 @@
 	__u64 lock_id;
 	__u32 num_to_send;
 	ocfs_node_map votemap;
-	int lockres_lock_held = NO_LOCK;
 
 	LOG_ENTRY_ARGS ("(0x%p, %u, %u, 0x%p)\n",
 			osb, lock_type, flags, lockres);
@@ -449,8 +446,7 @@
 
 	flags |= FLAG_RELEASE_LOCK;
 
-	ocfs_acquire_lockres_read (inode);
-	lockres_lock_held = READ_LOCK;
+	ocfs_acquire_lockres_write(inode);
 
 	if ((lockres->lock_type == OCFS_LKM_EXMODE) &&
 	    (lockres->master_node_num == osb->node_num) &&
@@ -472,10 +468,6 @@
 		goto unlock;
 	}
 
-	ocfs_release_lockres_read(inode);
-	ocfs_acquire_lockres_write(inode);
-	lockres_lock_held = WRITE_LOCK;
-
 	OCFS_ASSERT(lockres->uncommitted_holders <= lockres->lock_holders);
 
 	num_to_send = num_ident;
@@ -552,10 +544,7 @@
 	LOG_TRACE_ARGS("lockres->lock_holders = %u\n", lockres->lock_holders);
 
 unlock:
-	if (lockres_lock_held == READ_LOCK)
-		ocfs_release_lockres_read (inode);
-	else if (lockres_lock_held == WRITE_LOCK)
-		ocfs_release_lockres_write (inode);
+	ocfs_release_lockres_write (inode);
   	LOG_EXIT_STATUS (status);
 	return (status);
 }				/* ocfs_release_lock_full */



More information about the Ocfs2-commits mailing list