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: Yangtao Li <frank.li@vivo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Yangtao Li 2023-03-02 17:55:09 +08:00 коммит произвёл Jaegeuk Kim
Родитель 5bb9c111cd
Коммит b822dc9149
1 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -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;