From: Jens Axboe Date: Tue, 18 May 2010 12:31:45 +0000 (+0200) Subject: writeback: bdi_writeback_task() must set task state before calling schedule() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f9eadbbd424c083b8005c7b738f644611b9ef489;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 --- 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(); }