Skip to content

Commit

Permalink
writeback: bdi_writeback_task() must set task state before calling sc…
Browse files Browse the repository at this point in the history
…hedule()

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 69b62d0.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
  • Loading branch information
Jens Axboe committed May 21, 2010
1 parent 7c8a355 commit f9eadbb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions fs/fs-writeback.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit f9eadbb

Please sign in to comment.