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

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Jul 26 22:06:05 CDT 2004


Author: mfasheh
Date: 2004-07-26 21:06:03 -0500 (Mon, 26 Jul 2004)
New Revision: 1305

Modified:
   trunk/src/journal.c
Log:
* fix an off by one in optimize_lock_list

* we derefed 'bh' in handle_add_lock, which can be null. also add an
  assert on inode as *that's* derefed now instead but actually *shouldn't* be null.

* fix another bh == null potential issue



Modified: trunk/src/journal.c
===================================================================
--- trunk/src/journal.c	2004-07-26 19:00:02 UTC (rev 1304)
+++ trunk/src/journal.c	2004-07-27 02:06:03 UTC (rev 1305)
@@ -143,6 +143,8 @@
 			if ((first->flags & FLAG_FILE_EXTEND) 
 			    || (first->flags & FLAG_FILE_TRUNCATE))
 				first->num_ident++;
+			else
+				first->drop_holders++;
 		} else {
 			/* Ok, no size change on this particular lock,
 			 * so we're discarding it without updating the
@@ -158,9 +160,9 @@
 		if (lock->flags & FLAG_FILE_TRUNCATE)
 			first->flags = first->flags | FLAG_FILE_TRUNCATE;
 
-		if (!first->bh)
+		if (lock->bh && !first->bh)
 			first->bh = lock->bh;
-		else
+		else if (lock->bh)
 			brelse(lock->bh);
 		iput(lock->inode);
 
@@ -1073,9 +1075,11 @@
 {
 	ocfs_journal_lock *lock;
 
-	LOG_ENTRY_ARGS("(id=%llu, type=%u, flags=%u, bh=%p)\n",
-			(unsigned long long)bh->b_blocknr, type, flags, bh);
+	OCFS_ASSERT(inode);
 
+	LOG_ENTRY_ARGS("(inode=%llu, type=%u, flags=%u, bh=%p)\n",
+			OCFS_I(inode)->ip_blkno, type, flags, bh);
+
 	lock = kmem_cache_alloc(OcfsGlobalCtxt.lock_cache, GFP_NOFS);
 	if (lock == NULL) {
 		LOG_ERROR_STR("Out of memory -- cannot add lock to release.");



More information about the Ocfs2-commits mailing list