JFS: call io_schedule() instead of schedule() to avoid deadlock
authorDave Kleikamp <shaggy@linux.vnet.ibm.com>
Thu, 18 Jan 2007 03:18:35 +0000 (21:18 -0600)
committerDave Kleikamp <shaggy@linux.vnet.ibm.com>
Thu, 18 Jan 2007 03:18:35 +0000 (21:18 -0600)
The introduction of Jens Axboe's explicit i/o plugging patches introduced a
deadlock in jfs.  This was caused by the process initiating I/O not
unplugging the queue before waiting on the commit thread.  The commit
thread itself was waiting for that I/O to complete.  Calling io_schedule()
rather than schedule() unplugs the I/O queue avoiding the deadlock, and it
appears to be the right function to call in any case.

Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
fs/jfs/jfs_lock.h
fs/jfs/jfs_metapage.c
fs/jfs/jfs_txnmgr.c

index 7d78e83d7c40eaee39c0b9e67b6210b5ea40504c..df48ece4b7a3cdb7713b32c96121c9408d376e89 100644 (file)
@@ -42,7 +42,7 @@ do {                                                  \
                if (cond)                               \
                        break;                          \
                unlock_cmd;                             \
-               schedule();                             \
+               io_schedule();                          \
                lock_cmd;                               \
        }                                               \
        current->state = TASK_RUNNING;                  \
index ceaf03b94935c2b021efa38de64a228b1f5ca037..58deae0075073afe200e623a560dbfff2a3cbb4b 100644 (file)
@@ -56,7 +56,7 @@ static inline void __lock_metapage(struct metapage *mp)
                set_current_state(TASK_UNINTERRUPTIBLE);
                if (metapage_locked(mp)) {
                        unlock_page(mp->page);
-                       schedule();
+                       io_schedule();
                        lock_page(mp->page);
                }
        } while (trylock_metapage(mp));
index d558e51b0df8ffe4217b091f68a26bc7389dfcc2..6988a1082f5818e48fe4dd36d4aab07bc0016f50 100644 (file)
@@ -135,7 +135,7 @@ static inline void TXN_SLEEP_DROP_LOCK(wait_queue_head_t * event)
        add_wait_queue(event, &wait);
        set_current_state(TASK_UNINTERRUPTIBLE);
        TXN_UNLOCK();
-       schedule();
+       io_schedule();
        current->state = TASK_RUNNING;
        remove_wait_queue(event, &wait);
 }