[PATCH 3/3] JFS: Fix race in txLock

[email protected] (Dave Kleikamp) Wed, 10 Aug 2005 11:46:29 -0500 (CDT)
Newsgroups gmane.comp.file-systems.jfs.patches
Message-ID <[email protected]>
JFS: Fix race in txLock

TxAnchor.anon_list is protected by jfsTxnLock (TXN_LOCK), but there was
a place in txLock() that was removing an entry from the list without holding
the spinlock.

Signed-off-by: Dave Kleikamp <[email protected]>

---
commit 8a9cd6d676728792aaee31f30015d284acd154a3
tree 7e40b3b1802b1a86603f7ac6bf74906775a2956e
parent a5c96cab8f3c4ca9b2177dceb5de5a0edb31418e
author Dave Kleikamp <[email protected]> Wed, 10 Aug 2005 11:14:39 -0500
committer Dave Kleikamp <[email protected]> Wed, 10 Aug 2005 11:14:39 -0500

 fs/jfs/jfs_txnmgr.c |    2 ++
 fs/jfs/super.c      |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
--- a/fs/jfs/jfs_txnmgr.c
+++ b/fs/jfs/jfs_txnmgr.c
@@ -657,7 +657,9 @@ struct tlock *txLock(tid_t tid, struct i
 				/* only anonymous txn.
 				 * Remove from anon_list
 				 */
+				TXN_LOCK();
 				list_del_init(&jfs_ip->anon_inode_list);
+				TXN_UNLOCK();
 			}
 			jfs_ip->atlhead = tlck->next;
 		} else {
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -114,6 +114,8 @@ static void jfs_destroy_inode(struct ino
 {
 	struct jfs_inode_info *ji = JFS_IP(inode);
 
+	BUG_ON(!list_empty(&ji->anon_inode_list));
+
 	spin_lock_irq(&ji->ag_lock);
 	if (ji->active_ag != -1) {
 		struct bmap *bmap = JFS_SBI(inode->i_sb)->bmap;


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf