From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Kleikamp Subject: [PATCH] JFS: Fix race waking up jfsIO kernel thread Date: Fri, 04 May 2007 10:37:34 -0500 Message-ID: <1178293054.13717.13.camel@kleikamp.austin.ibm.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit To: JFS Discussion , fsdevel Return-path: Received: from e4.ny.us.ibm.com ([32.97.182.144]:54803 "EHLO e4.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030476AbXEDPhn (ORCPT ); Fri, 4 May 2007 11:37:43 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e4.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id l44FbgDQ031027 for ; Fri, 4 May 2007 11:37:42 -0400 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v8.3) with ESMTP id l44Fbblx520792 for ; Fri, 4 May 2007 11:37:42 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l44Fbaxb022649 for ; Fri, 4 May 2007 11:37:37 -0400 Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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 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