summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2018-05-28 16:59:27 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-08-03 07:55:14 +0200
commit4e6b7aad50edd0521ac69f5de9c8a4d03e40453a (patch)
treef883c1cec54b5892a5b2e66085581d20b3734448 /fs
parentc9ab0cefc59e0deddf85edd8ab3d310570a0367c (diff)
f2fs: fix error path of move_data_page
[ Upstream commit 14a28559f43ac7c0b98dd1b0e73ec9ec8ab4fc45 ] This patch fixes error path of move_data_page: - clear cold data flag if it fails to write page. - redirty page for non-ENOMEM case. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/gc.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 17ab23f64bba..ad4dfd29d923 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -688,9 +688,14 @@ retry:
set_cold_data(page);
err = do_write_data_page(&fio);
- if (err == -ENOMEM && is_dirty) {
- congestion_wait(BLK_RW_ASYNC, HZ/50);
- goto retry;
+ if (err) {
+ clear_cold_data(page);
+ if (err == -ENOMEM) {
+ congestion_wait(BLK_RW_ASYNC, HZ/50);
+ goto retry;
+ }
+ if (is_dirty)
+ set_page_dirty(page);
}
clear_cold_data(page);