f2fs: add missing f2fs_balance_fs in f2fs_zero_range
authorChao Yu <yuchao0@huawei.com>
Tue, 11 Oct 2016 14:57:02 +0000 (22:57 +0800)
committerJaegeuk Kim <jaegeuk@google.com>
Mon, 25 Sep 2017 22:04:53 +0000 (15:04 -0700)
commit 9434fcde1fa0f48e1a29fbdd9d436fa279aeb909 upstream.

f2fs_balance_fs should be called in between node page updating, otherwise
node page count will exceeded far beyond watermark of triggering
foreground garbage collection, result in facing high risk of hitting LFS
allocation failure.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/file.c

index 5c4ea4cf2fb1087d857f6b968ca41bae94aabd15..c0774c98dce4330df92a64da8cfcf688ef4535f6 100644 (file)
@@ -1222,6 +1222,9 @@ static int f2fs_zero_range(struct inode *inode, loff_t offset, loff_t len,
                        ret = f2fs_do_zero_range(&dn, index, end);
                        f2fs_put_dnode(&dn);
                        f2fs_unlock_op(sbi);
+
+                       f2fs_balance_fs(sbi, dn.node_changed);
+
                        if (ret)
                                goto out;