Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm, writeback: flush plugged IO in wakeup_flusher_threads()

I've found funny live-lock between raid10 barriers during resync and
memory controller hard limits. Inside mpage_readpages() task holds on to
its plug bio which blocks the barrier in raid10. Its memory cgroup have
no free memory thus the task goes into reclaimer but all reclaimable
pages are dirty and cannot be written because raid10 is rebuilding and
stuck on the barrier.

Common flush of such IO in schedule() never happens, because the caller
doesn't go to sleep.

Lock is 'live' because changing memory limit or killing tasks which
holds that stuck bio unblock whole progress.

That was what happened in 3.18.x but I see no difference in upstream
logic. Theoretically this might happen even without memory cgroup.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Signed-off-by: Jens Axboe <axboe@fb.com>

authored by

Konstantin Khlebnikov and committed by
Jens Axboe
51350ea0 d3f422c8

+6
+6
fs/fs-writeback.c
··· 1949 1949 { 1950 1950 struct backing_dev_info *bdi; 1951 1951 1952 + /* 1953 + * If we are expecting writeback progress we must submit plugged IO. 1954 + */ 1955 + if (blk_needs_flush_plug(current)) 1956 + blk_schedule_flush_plug(current); 1957 + 1952 1958 if (!nr_pages) 1953 1959 nr_pages = get_nr_dirty_pages(); 1954 1960