diff options
author | Yangtao Li <frank.li@vivo.com> | 2023-03-02 12:55:09 +0300 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2023-03-30 01:17:39 +0300 |
commit | b822dc914917f9381e7a04ff6872c1b6883dd4ae (patch) | |
tree | 9d5ca48a5f16f216ad886b6b11043cdbdc44ab7a /fs/f2fs | |
parent | 5bb9c111cd98ad844d48ace9924e29f56312f036 (diff) | |
download | linux-b822dc914917f9381e7a04ff6872c1b6883dd4ae.tar.xz |
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>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/file.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 3fbfdfdca72f..836173c53eb9 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -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; |