]> 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:49:04 +0000 (11:49 +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 f6fbe61b1251eb80fa2e9512797c3de45b8a6a46..2390f7943f6c8208ad59daa5b06c51b0687bc6fd 100644 (file)
@@ -1310,6 +1310,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;
                        }