summaryrefslogtreecommitdiff
path: root/fs/f2fs/file.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2015-01-09 16:27:17 -0800
committerJaegeuk Kim <jaegeuk@kernel.org>2015-02-11 17:04:30 -0800
commit871f599f4a869d24ef98b0217f19f0cc55ff59ac (patch)
tree24bfdfff79ff3b008a8996dc88f210659a12edfc /fs/f2fs/file.c
parent08e4126e1e91b01bea5c71980e7008ec5075d701 (diff)
f2fs: avoid infinite loop on cp_error
If cp_error is set, we should avoid all the infinite loop. In f2fs_sync_file, there is a hole, and this patch fixes that. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r--fs/f2fs/file.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 5df336757d6c..710adc987937 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -247,6 +247,10 @@ go_write:
sync_nodes:
sync_node_pages(sbi, ino, &wbc);
+ /* if cp_error was enabled, we should avoid infinite loop */
+ if (unlikely(f2fs_cp_error(sbi)))
+ goto out;
+
if (need_inode_block_update(sbi, ino)) {
mark_inode_dirty_sync(inode);
f2fs_write_inode(inode, NULL);