From: Chao Yu Date: Fri, 19 Jun 2020 09:14:19 +0000 (+0800) Subject: f2fs: fix to check page dirty status before writeback X-Git-Tag: v5.7.18~90 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a69c653ee9e029d8cd38eb3cb9850c9e90b8237a;p=thirdparty%2Fkernel%2Fstable.git f2fs: fix to check page dirty status before writeback [ Upstream commit eb1353cfa9c1e9415b03dc117f8399969fa02102 ] In f2fs_write_raw_pages(), we need to check page dirty status before writeback, because there could be a racer (e.g. reclaimer) helps writebacking the dirty page. Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c index 527d50edcb956..b397121dfa107 100644 --- a/fs/f2fs/compress.c +++ b/fs/f2fs/compress.c @@ -1207,6 +1207,12 @@ retry_write: congestion_wait(BLK_RW_ASYNC, DEFAULT_IO_TIMEOUT); lock_page(cc->rpages[i]); + + if (!PageDirty(cc->rpages[i])) { + unlock_page(cc->rpages[i]); + continue; + } + clear_page_dirty_for_io(cc->rpages[i]); goto retry_write; }