[Devel] [vzlin-dev] [PATCH vz7] fs: avoid writeback busy-loop if redirty
Vasily Averin
vvs at virtuozzo.com
Wed Dec 14 01:25:46 PST 2016
Maxim,
did you asked Alexey probably?
Also can you replace BUG_ON on WARN_ON ?
IMHO it's bad idea to crash kernel in any such cases.
If it can be triggered somehow from inside container -- it will be pure security issue.
Thank you,
Vasily Averin
On 12/14/2016 07:09 AM, Maxim Patlasov wrote:
> Andrey, can you please review this one-liner below. I think it can
> be responsible for inexplicable delays and CPU peaks in bugs like
> https://jira.sw.ru/browse/PSBM-55919. Thanks, Maxim
>
> wb_writeback() bails out only if either nr_pages comes to zero or
> "progress" (as reported by writeback_sb_inodes or __writeback_inodes_wb)
> is zero.
>
> If a page is temporarily unavailable (is under fuse-writeback),
> fuse_writepages_fill calls redirty_page_for_writepage, unlock the page
> and returns OK. This OK results in progress=1. So wb_writeback
> loops over writeback_sb_inodes/__writeback_inodes_wb again and again
> until all nr_pages are exhausted.
>
> The patch ensures that progress=0 if fuse_writepages_fill did nothing.
>
> Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
> ---
> fs/fs-writeback.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
> index 5c9a082..483bbb9 100644
> --- a/fs/fs-writeback.c
> +++ b/fs/fs-writeback.c
> @@ -774,6 +774,9 @@ static long writeback_sb_inodes(struct super_block *sb,
> if (work->nr_pages <= 0)
> break;
> }
> +
> + BUG_ON(wbc.pages_skipped > write_chunk - wbc.nr_to_write);
> + wrote -= wbc.pages_skipped;
> }
> return wrote;
> }
>
>
More information about the Devel
mailing list