aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/file.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2014-08-07 19:32:25 -0400
committerJaegeuk Kim <jaegeuk@kernel.org>2014-08-19 13:01:33 -0400
commitb067ba1f1b3fa7ec798d35e12aed6cdba9cea905 (patch)
tree1095778a55a4577811f6f98d0e1a21822bbf47ab /fs/f2fs/file.c
parente1c42045203071c4634b89e696037357810d3083 (diff)
f2fs: should convert inline_data during the mkwrite
If mkwrite is called to an inode having inline_data, it can overwrite the data index space as NEW_ADDR. (e.g., the first 4 bytes are coincidently zero) Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r--fs/f2fs/file.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 87cdac4efeec..ecbdf6a6381c 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -41,6 +41,11 @@ static int f2fs_vm_page_mkwrite(struct vm_area_struct *vma,
41 41
42 sb_start_pagefault(inode->i_sb); 42 sb_start_pagefault(inode->i_sb);
43 43
44 /* force to convert with normal data indices */
45 err = f2fs_convert_inline_data(inode, MAX_INLINE_DATA + 1, page);
46 if (err)
47 goto out;
48
44 /* block allocation */ 49 /* block allocation */
45 f2fs_lock_op(sbi); 50 f2fs_lock_op(sbi);
46 set_new_dnode(&dn, inode, NULL, NULL, 0); 51 set_new_dnode(&dn, inode, NULL, NULL, 0);
@@ -533,7 +538,7 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
533 538
534 if ((attr->ia_valid & ATTR_SIZE) && 539 if ((attr->ia_valid & ATTR_SIZE) &&
535 attr->ia_size != i_size_read(inode)) { 540 attr->ia_size != i_size_read(inode)) {
536 err = f2fs_convert_inline_data(inode, attr->ia_size); 541 err = f2fs_convert_inline_data(inode, attr->ia_size, NULL);
537 if (err) 542 if (err)
538 return err; 543 return err;
539 544
@@ -622,7 +627,7 @@ static int punch_hole(struct inode *inode, loff_t offset, loff_t len)
622 loff_t off_start, off_end; 627 loff_t off_start, off_end;
623 int ret = 0; 628 int ret = 0;
624 629
625 ret = f2fs_convert_inline_data(inode, MAX_INLINE_DATA + 1); 630 ret = f2fs_convert_inline_data(inode, MAX_INLINE_DATA + 1, NULL);
626 if (ret) 631 if (ret)
627 return ret; 632 return ret;
628 633
@@ -678,7 +683,7 @@ static int expand_inode_data(struct inode *inode, loff_t offset,
678 if (ret) 683 if (ret)
679 return ret; 684 return ret;
680 685
681 ret = f2fs_convert_inline_data(inode, offset + len); 686 ret = f2fs_convert_inline_data(inode, offset + len, NULL);
682 if (ret) 687 if (ret)
683 return ret; 688 return ret;
684 689