aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2013-12-30 18:36:23 +0800
committerAndreas Blaesius <skate4life@gmx.de>2016-06-05 21:21:08 +0200
commitbd25fa1604528fb427d1014f612255951f4adc8c (patch)
tree8e059b897de81abe74462e3278c8069d4ca15dd3
parent817cc5135f4582d9c2799acdb9d75984a46ea303 (diff)
downloadkernel_samsung_espresso10-bd25fa1604528fb427d1014f612255951f4adc8c.zip
kernel_samsung_espresso10-bd25fa1604528fb427d1014f612255951f4adc8c.tar.gz
kernel_samsung_espresso10-bd25fa1604528fb427d1014f612255951f4adc8c.tar.bz2
f2fs: avoid to read inline data except first page
Here is a case which could read inline page data not from first page. 1. write inline data 2. lseek to offset 4096 3. read 4096 bytes from offset 4096 (read_inline_data read inline data page to non-first page, And previously VFS has add this page to page cache) 4. ftruncate offset 8192 5. read 4096 bytes from offset 4096 (we meet this updated page with inline data in cache) So we should leave this page with inited data and uptodate flag for this case. Change log from v1: o fix a deadlock bug Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
-rw-r--r--fs/f2fs/inline.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index 89f0c18..e0d800a 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -39,6 +39,11 @@ int f2fs_read_inline_data(struct inode *inode, struct page *page)
struct page *ipage;
void *src_addr, *dst_addr;
+ if (page->index) {
+ zero_user_segment(page, 0, PAGE_CACHE_SIZE);
+ goto out;
+ }
+
ipage = get_node_page(sbi, inode->i_ino);
if (IS_ERR(ipage))
return PTR_ERR(ipage);
@@ -52,6 +57,7 @@ int f2fs_read_inline_data(struct inode *inode, struct page *page)
kunmap(page);
f2fs_put_page(ipage, 1);
+out:
SetPageUptodate(page);
unlock_page(page);