]> err.no Git - linux-2.6/commitdiff
JFS: Fix race in txLock
authorDave Kleikamp <shaggy@austin.ibm.com>
Wed, 10 Aug 2005 16:14:39 +0000 (11:14 -0500)
committerDave Kleikamp <shaggy@austin.ibm.com>
Wed, 10 Aug 2005 16:14:39 +0000 (11:14 -0500)
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 <shaggy@austin.ibm.com>
fs/jfs/jfs_txnmgr.c
fs/jfs/super.c

index 3555acff12d0c5009520d9d672f17fe3e476bcfc..c7a92f9deb2b93c269d2b945418030f37f53ba51 100644 (file)
@@ -657,7 +657,9 @@ struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp,
                                /* 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 {
index c2abdaee0c0b56fd5f22eda6da423dfb2e7ebc35..9ff89720f93bab8bfeaee75ac656e04f6a0de3ee 100644 (file)
@@ -114,6 +114,8 @@ static void jfs_destroy_inode(struct inode *inode)
 {
        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;