aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2015-02-11 14:25:11 -0500
committerJaegeuk Kim <jaegeuk@kernel.org>2015-02-11 20:04:51 -0500
commitf1a3b98e73a9f811ab4882669043c50c0e0dc7b6 (patch)
tree74c23b5caad0291e31676a7ee8b4cea4cda36f3c /fs/f2fs
parent60a3b782b1aaf6e5f8c4f92e99302c48a26d475b (diff)
f2fs: fix accessing wrong indexed data blocks
This patch fixes the following test. This causes: attempt to access beyond end of device sdb2: rw=16384, want=14413962000, limit=16777216 The reason is: - f2fs_write_begin - f2fs_convert_inline_inode returns -ENOSPC - f2fs_write_failed - truncate_blocks - truncate_partial_data_page - find_data_page - get_dnode_of_data returns wrong data index retrieved from inline_data - f2fs_submit_page_bio(wrong data index) - submit_bio(wrong data index) Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/node.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 1e354ff9f7d8..97bd9d3db882 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -474,7 +474,7 @@ int get_dnode_of_data(struct dnode_of_data *dn, pgoff_t index, int mode)
474{ 474{
475 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); 475 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode);
476 struct page *npage[4]; 476 struct page *npage[4];
477 struct page *parent; 477 struct page *parent = NULL;
478 int offset[4]; 478 int offset[4];
479 unsigned int noffset[4]; 479 unsigned int noffset[4];
480 nid_t nids[4]; 480 nid_t nids[4];
@@ -491,6 +491,14 @@ int get_dnode_of_data(struct dnode_of_data *dn, pgoff_t index, int mode)
491 if (IS_ERR(npage[0])) 491 if (IS_ERR(npage[0]))
492 return PTR_ERR(npage[0]); 492 return PTR_ERR(npage[0]);
493 } 493 }
494
495 /* if inline_data is set, should not report any block indices */
496 if (f2fs_has_inline_data(dn->inode) && index) {
497 err = -EINVAL;
498 f2fs_put_page(npage[0], 1);
499 goto release_out;
500 }
501
494 parent = npage[0]; 502 parent = npage[0];
495 if (level != 0) 503 if (level != 0)
496 nids[1] = get_nid(parent, offset[0], true); 504 nids[1] = get_nid(parent, offset[0], true);