[PATCH] JFS: Avoid deadlock when all tblocks are allocated (2 of 2)

Dave Kleikamp <[email protected]> Tue, 25 Mar 2003 11:35:37 -0600
Newsgroups gmane.comp.file-systems.jfs.patches
Message-ID <[email protected]>
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1053.2.1 -> 1.1053.2.2
#	 fs/jfs/jfs_txnmgr.c	1.23    -> 1.24   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/03/24	[email protected]	1.1053.2.2
# JFS: Avoid deadlock when all tblocks are allocated
#   
# We need to save one tblock for forced transactions, and only transactions
# changing the inode allocation tables should be forced.
# --------------------------------------------
#
diff -Nru a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
--- a/fs/jfs/jfs_txnmgr.c	Tue Mar 25 11:13:20 2003
+++ b/fs/jfs/jfs_txnmgr.c	Tue Mar 25 11:13:20 2003
@@ -379,8 +379,8 @@
 
 	tblk = tid_to_tblock(t);
 
-	if ((tblk->next == 0) && (current != jfsCommitTask)) {
-		/* Save one tblk for jfsCommit thread */
+	if ((tblk->next == 0) && !(flag & COMMIT_FORCE)) {
+		/* Don't let a non-forced transaction take the last tblk */
 		jfs_info("txBegin: waiting for free tid");
 		INCREMENT(TxStat.txBegin_freetid);
 		TXN_SLEEP(&TxAnchor.freewait);
@@ -2997,8 +2997,7 @@
 				 * when it is committed
 				 */
 				TXN_UNLOCK();
-				tid = txBegin(ip->i_sb,
-					      COMMIT_INODE | COMMIT_FORCE);
+				tid = txBegin(ip->i_sb, COMMIT_INODE);
 				rc = txCommit(tid, 1, &ip, 0);
 				txEnd(tid);
 				up(&jfs_ip->commit_sem);