[PATCH] thread sleeping in txLock() when it shouldn't (12 of 12)

[email protected] (Dave Kleikamp) Thu, 31 Mar 2005 14:50:05 -0600 (CST)
Newsgroups gmane.comp.file-systems.jfs.patches
Message-ID <[email protected]>
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/03/30 17:29:58-06:00 [email protected] 
#   JFS: thread sleeping in txLock() when it shouldn't
#   
#   txRelease only clears mp->lid, so that's what really needs to be
#   checked before sleeping.  Otherwise if txRelease is called while we
#   had released TXN_LOCK, we could sleep forever.
#   
#   Signed-off-by: Dave Kleikamp <[email protected]>
# 
diff -Nru a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
--- a/fs/jfs/jfs_txnmgr.c	2005-03-31 14:19:18 -06:00
+++ b/fs/jfs/jfs_txnmgr.c	2005-03-31 14:19:18 -06:00
@@ -857,7 +857,9 @@
 
 	jfs_info("txLock: in waitLock, tid = %d, xtid = %d, lid = %d",
 		 tid, xtid, lid);
-	if (xtid && (tlck->mp == mp))
+
+	/* Recheck everything since dropping TXN_LOCK */
+	if (xtid && (tlck->mp == mp) && (mp->lid == lid))
 		TXN_SLEEP_DROP_LOCK(&tid_to_tblock(xtid)->waitor);
 	else
 		TXN_UNLOCK();


-------------------------------------------------------
This SF.net email is sponsored by Demarc:
A global provider of Threat Management Solutions.
Download our HomeAdmin security software for free today!
http://www.demarc.com/info/Sentarus/hamr30