]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
f2fs: fix to check page dirty status before writeback
authorChao Yu <yuchao0@huawei.com>
Fri, 19 Jun 2020 09:14:19 +0000 (17:14 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Aug 2020 09:42:10 +0000 (11:42 +0200)
[ 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 <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/compress.c

index 527d50edcb956acfb02df23ccc794f5ae9660991..b397121dfa1077fd86c3ce2b3c65112f06ce8889 100644 (file)
@@ -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;
                        }