diff options
author | Chao Yu <yuchao0@huawei.com> | 2020-07-24 13:21:36 +0300 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2020-07-26 18:19:06 +0300 |
commit | 944dd22ea4475bd11180fd2f431a4a547ca4d8f5 (patch) | |
tree | 4ddd109ccc26d7a02dc47fb1f1f3af8a25b10608 /fs/f2fs | |
parent | a87aff1d491f6d824d9cc53303544361d7eaae75 (diff) | |
download | linux-944dd22ea4475bd11180fd2f431a4a547ca4d8f5.tar.xz |
f2fs: compress: fix to update isize when overwriting compressed file
We missed to update isize of compressed file in write_end() with
below case:
cluster size is 16KB
- write 14KB data from offset 0
- overwrite 16KB data from offset 0
Fixes: 4c8ff7095bef ("f2fs: support data compression")
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/data.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 3b8409ce24f2..bc89bc987513 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -3470,6 +3470,10 @@ static int f2fs_write_end(struct file *file, if (f2fs_compressed_file(inode) && fsdata) { f2fs_compress_write_end(inode, fsdata, page->index, copied); f2fs_update_time(F2FS_I_SB(inode), REQ_TIME); + + if (pos + copied > i_size_read(inode) && + !f2fs_verity_in_progress(inode)) + f2fs_i_size_write(inode, pos + copied); return copied; } #endif |