Skip to content

Commit c4ec790

Browse files
Artem BityutskiyJens Axboe
authored andcommitted
writeback: do not lose wake-ups in the forker thread - 2
Currently, if someone submits jobs for the default bdi, we can lose wake-up events. E.g., this can happen if 'bdi_queue_work()' is called when 'bdi_forker_thread()' is executing code after 'wb_do_writeback(me, 0)', but before 'set_current_state(TASK_INTERRUPTIBLE)'. This situation is unlikely, and the result is not very severe - we'll just delay the execution of the work, but this is still not very nice. This patch fixes the issue by checking whether the default bdi has works before the forker thread goes sleep. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
1 parent c5f7ad2 commit c4ec790

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎mm/backing-dev.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,10 @@ static int bdi_forker_thread(void *ptr)
358358
bdi_add_default_flusher_thread(bdi);
359359
}
360360

361+
/* Keep working if default bdi still has things to do */
362+
if (!list_empty(&me->bdi->work_list))
363+
__set_current_state(TASK_RUNNING);
364+
361365
if (list_empty(&bdi_pending_list)) {
362366
unsigned long wait;
363367

0 commit comments

Comments
 (0)