summary refs log tree commit diff
path: root/fs/fs-writeback.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2010-05-18 14:31:45 +0200
committerJens Axboe <jens.axboe@oracle.com>2010-05-21 20:00:25 +0200
commitf9eadbbd424c083b8005c7b738f644611b9ef489 (patch)
treeedc73e0fa56de566af7672f6f80579ec317d373f /fs/fs-writeback.c
parent7c8a3554c683f512dbcee26faedb42e4c05f12fa (diff)
downloadlinux-f9eadbbd424c083b8005c7b738f644611b9ef489.tar.gz
writeback: bdi_writeback_task() must set task state before calling schedule()
Calling schedule without setting the task state to non-running will
return immediately, so ensure that we set it properly and check our
sleep conditions after doing so.

This is a fixup for commit 69b62d01.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'fs/fs-writeback.c')
-rw-r--r--fs/fs-writeback.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 76f546d56a64..437a7431b4ea 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -978,8 +978,13 @@ int bdi_writeback_task(struct bdi_writeback *wb)
 		if (dirty_writeback_interval) {
 			wait_jiffies = msecs_to_jiffies(dirty_writeback_interval * 10);
 			schedule_timeout_interruptible(wait_jiffies);
-		} else
-			schedule();
+		} else {
+			set_current_state(TASK_INTERRUPTIBLE);
+			if (list_empty_careful(&wb->bdi->work_list) &&
+			    !kthread_should_stop())
+				schedule();
+			__set_current_state(TASK_RUNNING);
+		}
 
 		try_to_freeze();
 	}