diff options
author | Chao Yu <chao2.yu@samsung.com> | 2014-04-29 03:03:03 +0200 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-05-07 03:21:58 +0200 |
commit | 8aa6f1c5bd7043734fff1961a4795da9cc5d0f50 (patch) | |
tree | c2b9ae38929b9511919fabda9429eec05e75d5c2 /fs/f2fs/file.c | |
parent | f2fs: readahead multi pages of directory for performance (diff) | |
download | linux-8aa6f1c5bd7043734fff1961a4795da9cc5d0f50.tar.xz linux-8aa6f1c5bd7043734fff1961a4795da9cc5d0f50.zip |
f2fs: fix to truncate inline data in inode page when setattr
Previous we do not truncate inline data in inode page when setattr, so following
case could still read the inline data which has already truncated:
1.write inline data
2.ftruncate size to 0
3.ftruncate size to max inline data size
4.read from offset 0
This patch introduces truncate_inline_data() to fix this problem.
change log from v1:
o fix a bug and do not truncate first page data after truncate inline data.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r-- | fs/f2fs/file.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index b9f4fbf5c07e..d97e5c458f36 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -369,6 +369,9 @@ static void truncate_partial_data_page(struct inode *inode, u64 from) unsigned offset = from & (PAGE_CACHE_SIZE - 1); struct page *page; + if (f2fs_has_inline_data(inode)) + return truncate_inline_data(inode, from); + if (!offset) return; |