diff options
| author | Chao Yu <yuchao0@huawei.com> | 2020-07-24 18:21:36 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-08-21 13:07:37 +0200 |
| commit | bfd05afee1d4de3d71d98d69937c4e63509aeb93 (patch) | |
| tree | 063b12f0ec2f0888e6c4171577a2ef3bf4f6a024 | |
| parent | 5a8e852af62c693fc2072c45db58d58cf9c81da0 (diff) | |
f2fs: compress: fix to update isize when overwriting compressed file
[ Upstream commit 944dd22ea4475bd11180fd2f431a4a547ca4d8f5 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
| -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 10491ae1cb85..329afa55a581 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -3353,6 +3353,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 |
