diff options
author | Chao Yu <yuchao0@huawei.com> | 2018-01-17 16:31:37 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-01-22 14:56:52 -0800 |
commit | eb4497975e82448746bb7de3d13b743b7145aed7 (patch) | |
tree | f76ff2785133e6412ed1b90236ceacd4aaed2fe8 /fs | |
parent | b323fd28bbf95c3181e02e7a642b7d24f3e32714 (diff) | |
download | linux-eb4497975e82448746bb7de3d13b743b7145aed7.tar.bz2 |
f2fs: fix to update last_disk_size correctly
This patch fixes to update last_disk_size only when writing out page
successfully.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/f2fs/data.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 2b892a619d71..fa91bfeb754b 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1716,10 +1716,14 @@ write: } } - down_write(&F2FS_I(inode)->i_sem); - if (F2FS_I(inode)->last_disk_size < psize) - F2FS_I(inode)->last_disk_size = psize; - up_write(&F2FS_I(inode)->i_sem); + if (err) { + file_set_keep_isize(inode); + } else { + down_write(&F2FS_I(inode)->i_sem); + if (F2FS_I(inode)->last_disk_size < psize) + F2FS_I(inode)->last_disk_size = psize; + up_write(&F2FS_I(inode)->i_sem); + } done: if (err && err != -ENOENT) |