linux-stable/fs/f2fs
Chao Yu 0bfcfcca3d f2fs: fix to truncate inline data past EOF
Previously if inode is with inline data, we will try to invalid partial inline
data in page #0 when we truncate size of inode in truncate_partial_data_page().
And then we set page #0 to dirty, after this we can synchronize inode page with
page #0 at ->writepage().

But sometimes we will fail to operate page #0 in truncate_partial_data_page()
due to below reason:
a) if offset is zero, we will skip setting page #0 to dirty.
b) if page #0 is not uptodate, we will fail to update it as it has no mapping
data.

So with following operations, we will meet recent data which should be
truncated.

1.write inline data to file
2.sync first data page to inode page
3.truncate file size to 0
4.truncate file size to max_inline_size
5.echo 1 > /proc/sys/vm/drop_caches
6.read file --> meet original inline data which is remained in inode page.

This patch renames truncate_inline_data() to truncate_inline_inode() for code
readability, then use truncate_inline_inode() to truncate inline data in inode
page in truncate_blocks() and truncate page #0 in truncate_partial_data_page()
for fixing.

v2:
 o truncate partially #0 page in truncate_partial_data_page to avoid keeping
   old data in #0 page.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-04-10 15:08:41 -07:00
..
acl.c f2fs: fix reference leaks in f2fs_acl_create 2015-04-10 15:08:40 -07:00
acl.h f2fs: avoid deadlock on init_inode_metadata 2014-11-03 16:07:33 -08:00
checkpoint.c f2fs: cleanup statement about max orphan inodes calc 2015-04-10 15:08:38 -07:00
data.c f2fs: avoid to trigger writepage during POR 2015-04-10 15:08:32 -07:00
debug.c f2fs: add stat info for moved blocks by background gc 2015-04-10 15:08:32 -07:00
dir.c f2fs: fix to calculate max length of contiguous free slots correctly 2015-04-10 15:08:40 -07:00
f2fs.h f2fs: fix to truncate inline data past EOF 2015-04-10 15:08:41 -07:00
file.c f2fs: fix to truncate inline data past EOF 2015-04-10 15:08:41 -07:00
gc.c f2fs: add stat info for moved blocks by background gc 2015-04-10 15:08:32 -07:00
gc.h f2fs: fix sparse warnings 2015-02-11 17:04:49 -08:00
hash.c f2fs: fix wrong casting for dentry name 2014-08-29 00:26:50 -07:00
inline.c f2fs: fix to truncate inline data past EOF 2015-04-10 15:08:41 -07:00
inode.c f2fs: enable rb-tree extent cache 2015-03-03 09:58:47 -08:00
Kconfig f2fs: relocate Kconfig from misc filesystems 2015-04-10 15:08:35 -07:00
Makefile f2fs: add f2fs_io_tracer support 2015-01-09 17:02:24 -08:00
namei.c f2fs: fix incorrectly stat number of inline data inode 2015-03-03 09:58:45 -08:00
node.c f2fs: fix unlocked nat set cache operation 2015-04-10 15:08:39 -07:00
node.h f2fs: introduce infra macro and data structure of rb-tree extent cache 2015-03-03 09:58:46 -08:00
recovery.c f2fs: avoid wrong error during recovery 2015-03-03 09:58:48 -08:00
segment.c f2fs: fix to issue small discard in real-time mode discard 2015-04-10 15:08:31 -07:00
segment.h f2fs: reduce searching region of segmap when set free section 2015-04-10 15:08:36 -07:00
super.c f2fs: fix extent cache memory leak 2015-04-10 15:08:35 -07:00
trace.c f2fs: fix sparse warnings 2015-02-11 17:04:49 -08:00
trace.h f2fs: add f2fs_destroy_trace_ios to free radix tree 2015-01-09 17:02:28 -08:00
xattr.c f2fs: avoid deadlock on init_inode_metadata 2014-11-03 16:07:33 -08:00
xattr.h f2fs: avoid deadlock on init_inode_metadata 2014-11-03 16:07:33 -08:00