http://jfs.bkbits.net/linux-2.5
shaggy@austin.ibm.com|ChangeSet|20050316220318|28557 shaggy

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/03/16 15:43:34-06:00 shaggy@austin.ibm.com 
#   JFS: Fix hang caused by race waking commit threads
#   
#   The flag, jfs_commit_threads_waking, is meant to avoid waking up too
#   many jfs_commit threads when only one is needed.  There is a
#   possibility that all the threads will be running, and the flag gets
#   set, but never reset.  The fix is to make sure the flag is reset
#   before a thread sleeps.
#   
#   Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
# 
# fs/jfs/jfs_txnmgr.c
#   2005/03/16 15:43:17-06:00 shaggy@austin.ibm.com +3 -1
#   Reset jfs_commit_threads_waking before going to sleep
# 
# ChangeSet
#   2005/03/15 09:16:28-06:00 shaggy@austin.ibm.com 
#   JFS: Don't clobber wait_queue_head while there are waitors on it
#   
#   The resize code closes down the log and reinitializes it in another location
#   on the disk.  The problem is that it re-initializes a wait_queue_head while
#   there are waitors waiting for the resize to be completed.  The result
#   is that the waitors are never awakened.
#   
#   Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
# 
# fs/jfs/jfs_logmgr.c
#   2005/03/15 09:15:55-06:00 shaggy@austin.ibm.com +3 -2
#   Don't clobber wait_queue_head while there are waitors on it
# 
# ChangeSet
#   2005/03/13 18:10:17-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-jfs
# 
# MAINTAINERS
#   2005/03/13 18:10:12-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/12 12:38:08-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-jfs
# 
# MAINTAINERS
#   2005/03/12 12:38:03-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/10 12:11:55-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-jfs
# 
# MAINTAINERS
#   2005/03/10 12:11:50-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/08 23:38:39-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-jfs
# 
# MAINTAINERS
#   2005/03/08 23:38:34-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/08 13:14:29-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-jfs
# 
# MAINTAINERS
#   2005/03/08 13:14:24-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/07 14:55:45-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-jfs
# 
# MAINTAINERS
#   2005/03/07 14:55:38-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/07 13:59:12-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-jfs
# 
# MAINTAINERS
#   2005/03/07 13:59:07-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/06 19:24:18-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-jfs
# 
# MAINTAINERS
#   2005/03/06 19:24:13-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/05 15:22:26-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-jfs
# 
# MAINTAINERS
#   2005/03/05 15:22:21-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/04 20:50:25-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-jfs
# 
# MAINTAINERS
#   2005/03/04 20:50:20-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
diff -Nru a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
--- a/fs/jfs/jfs_logmgr.c	2005-03-20 16:31:45 -08:00
+++ b/fs/jfs/jfs_logmgr.c	2005-03-20 16:31:45 -08:00
@@ -1119,6 +1119,7 @@
 	}
 	memset(log, 0, sizeof(struct jfs_log));
 	INIT_LIST_HEAD(&log->sb_list);
+	init_waitqueue_head(&log->syncwait);
 
 	/*
 	 *      external log as separate logical volume
@@ -1192,6 +1193,7 @@
 		return -ENOMEM;
 	memset(log, 0, sizeof(struct jfs_log));
 	INIT_LIST_HEAD(&log->sb_list);
+	init_waitqueue_head(&log->syncwait);
 
 	set_bit(log_INLINELOG, &log->flag);
 	log->bdev = sb->s_bdev;
@@ -1229,6 +1231,7 @@
 		}
 		memset(dummy_log, 0, sizeof(struct jfs_log));
 		INIT_LIST_HEAD(&dummy_log->sb_list);
+		init_waitqueue_head(&dummy_log->syncwait);
 		dummy_log->no_integrity = 1;
 		/* Make up some stuff */
 		dummy_log->base = 0;
@@ -1290,8 +1293,6 @@
 	LOGSYNC_LOCK_INIT(log);
 
 	INIT_LIST_HEAD(&log->synclist);
-
-	init_waitqueue_head(&log->syncwait);
 
 	INIT_LIST_HEAD(&log->cqueue);
 	log->flush_tblk = NULL;
diff -Nru a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
--- a/fs/jfs/jfs_txnmgr.c	2005-03-20 16:31:45 -08:00
+++ b/fs/jfs/jfs_txnmgr.c	2005-03-20 16:31:45 -08:00
@@ -1,5 +1,5 @@
 /*
- *   Copyright (C) International Business Machines Corp., 2000-2004
+ *   Copyright (C) International Business Machines Corp., 2000-2005
  *   Portions Copyright (C) Christoph Hellwig, 2001-2002
  *
  *   This program is free software;  you can redistribute it and/or modify
@@ -2796,6 +2796,8 @@
 			if (!WorkDone)
 				break;
 		}
+		/* In case a wakeup came while all threads were active */
+		jfs_commit_thread_waking = 0;
 
 		if (current->flags & PF_FREEZE) {
 			LAZY_UNLOCK(flags);