aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-07-25 07:29:15 -0400
committerJens Axboe <jaxboe@fusionio.com>2010-08-07 12:53:55 -0400
commit297252c81de8043ca6c36e5984c24fdb5aab9013 (patch)
treed94a35abcd3b227b072955622f703a2cdc3c309d
parentc4ec7908c2c5125f75fabd100e7a95626a6883ee (diff)
writeback: do not lose wake-ups in bdi threads
Currently, bdi threads ('bdi_writeback_thread()') can lose wake-ups. For example, if 'bdi_queue_work()' is executed after the bdi thread have had finished 'wb_do_writeback()' but before it called 'schedule_timeout_interruptible()'. To fix this issue, we have to check whether we have works to process after we have changed the task state to 'TASK_INTERRUPTIBLE'. This patch also clean-ups handling of the cases when 'dirty_writeback_interval' is zero or non-zero. Additionally, this patch also removes unneeded 'list_empty_careful()' call. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
-rw-r--r--fs/fs-writeback.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 002be0ff2ab3..05444eaa3f36 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -848,17 +848,18 @@ int bdi_writeback_thread(void *data)
848 break; 848 break;
849 } 849 }
850 850
851 if (dirty_writeback_interval) { 851 set_current_state(TASK_INTERRUPTIBLE);
852 wait_jiffies = msecs_to_jiffies(dirty_writeback_interval * 10); 852 if (!list_empty(&bdi->work_list)) {
853 schedule_timeout_interruptible(wait_jiffies);
854 } else {
855 set_current_state(TASK_INTERRUPTIBLE);
856 if (list_empty_careful(&wb->bdi->work_list) &&
857 !kthread_should_stop())
858 schedule();
859 __set_current_state(TASK_RUNNING); 853 __set_current_state(TASK_RUNNING);
854 continue;
860 } 855 }
861 856
857 if (dirty_writeback_interval) {
858 wait_jiffies = msecs_to_jiffies(dirty_writeback_interval * 10);
859 schedule_timeout(wait_jiffies);
860 } else
861 schedule();
862
862 try_to_freeze(); 863 try_to_freeze();
863 } 864 }
864 865