summaryrefslogtreecommitdiff
path: root/fs/f2fs/checkpoint.c
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2015-07-29 17:33:13 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2015-08-05 08:08:17 -0700
commitf3f338caad3428fbc4bb563828efc6ecce4d956b (patch)
tree77e414f71793e873e5c4228b91920e3926bbee0c /fs/f2fs/checkpoint.c
parent5768dcdd7f7675f9540e648428c8a1cd7208a0fe (diff)
downloadlinux-f3f338caad3428fbc4bb563828efc6ecce4d956b.tar.gz
linux-f3f338caad3428fbc4bb563828efc6ecce4d956b.tar.xz
f2fs: freeze filesystem when fail to update meta page due to IO error
In get_meta_page, we guarantee no failure for the returned page, but sometimes, IO error from device will incur returning an non-updated page. Then, we still use this page as updated one, exception could happen when using this kind of page. So in this condition, we'd better freeze fs by making fs readonly and and stop doing checkpoint. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/checkpoint.c')
-rw-r--r--fs/f2fs/checkpoint.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 6fb696da42e8..9c1acf69bfbb 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -79,6 +79,14 @@ repeat:
f2fs_put_page(page, 1);
goto repeat;
}
+
+ /*
+ * if there is any IO error when accessing device, make our filesystem
+ * readonly and make sure do not write checkpoint with non-uptodate
+ * meta page.
+ */
+ if (unlikely(!PageUptodate(page)))
+ f2fs_stop_checkpoint(sbi);
out:
return page;
}