Commit b822dc91 authored by Yangtao Li's avatar Yangtao Li Committed by Jaegeuk Kim

f2fs: fix to handle filemap_fdatawrite() error in f2fs_ioc_decompress_file/f2fs_ioc_compress_file

It seems inappropriate that the current logic does not handle
filemap_fdatawrite() errors, so let's fix it.
Signed-off-by: default avatarYangtao Li <frank.li@vivo.com>
Reviewed-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 5bb9c111
......@@ -4063,8 +4063,11 @@ static int f2fs_ioc_decompress_file(struct file *filp)
if (ret < 0)
break;
if (get_dirty_pages(inode) >= blk_per_seg)
filemap_fdatawrite(inode->i_mapping);
if (get_dirty_pages(inode) >= blk_per_seg) {
ret = filemap_fdatawrite(inode->i_mapping);
if (ret < 0)
break;
}
count -= len;
page_idx += len;
......@@ -4134,8 +4137,11 @@ static int f2fs_ioc_compress_file(struct file *filp)
if (ret < 0)
break;
if (get_dirty_pages(inode) >= blk_per_seg)
filemap_fdatawrite(inode->i_mapping);
if (get_dirty_pages(inode) >= blk_per_seg) {
ret = filemap_fdatawrite(inode->i_mapping);
if (ret < 0)
break;
}
count -= len;
page_idx += len;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment