linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] JFS: Fix race waking up jfsIO kernel thread
@ 2007-05-04 15:37 Dave Kleikamp
  0 siblings, 0 replies; only message in thread
From: Dave Kleikamp @ 2007-05-04 15:37 UTC (permalink / raw)
  To: JFS Discussion, fsdevel

I've been looking at a hang that was reported off-list, and I believe I
found the cause.  I'm still waiting for confirmation on whether the
patch does fix the problem, but I wanted to distribute the patch in case
anyone else is seeing a similar hang.  It looks like the problem is in
kernels from 2.6.17 to the present.

Thanks,
Shaggy

JFS: Fix race waking up jfsIO kernel thread

It's possible for a journal I/O request to be added to the log_redrive
queue and the jfsIO thread to be awakened after the thread releases
log_redrive_lock but before it sets its state to TASK_INTERRUPTIBLE.

The jfsIO thread should set its state before giving up the spinlock, so
the waking thread will really wake it.

Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>

diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
index ff7f1be..16c6268 100644
--- a/fs/jfs/jfs_logmgr.c
+++ b/fs/jfs/jfs_logmgr.c
@@ -2354,12 +2354,13 @@ int jfsIOWait(void *arg)
 			lbmStartIO(bp);
 			spin_lock_irq(&log_redrive_lock);
 		}
-		spin_unlock_irq(&log_redrive_lock);
 
 		if (freezing(current)) {
+			spin_unlock_irq(&log_redrive_lock);
 			refrigerator();
 		} else {
 			set_current_state(TASK_INTERRUPTIBLE);
+			spin_unlock_irq(&log_redrive_lock);
 			schedule();
 			__set_current_state(TASK_RUNNING);
 		}

-- 
David Kleikamp
IBM Linux Technology Center


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-05-04 15:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-04 15:37 [PATCH] JFS: Fix race waking up jfsIO kernel thread Dave Kleikamp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).