aboutsummaryrefslogtreecommitdiff
path: root/fs/f2fs/inline.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2013-12-27 17:04:17 +0900
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2014-01-06 16:42:21 +0900
commita8865372a8414298982e07f4ac8d6dc0ab1e0a3d (patch)
treed854711c56be4c135701610710c0fda95a297d13 /fs/f2fs/inline.c
parent1e1bb4baf10be371f72150e2801d97a04d40b3b9 (diff)
f2fs: handle errors correctly during f2fs_reserve_block
The get_dnode_of_data nullifies inode and node page when error is occurred. There are two cases that passes inode page into get_dnode_of_data(). 1. make_empty_dir() -> get_new_data_page() -> f2fs_reserve_block(ipage) -> get_dnode_of_data() 2. f2fs_convert_inline_data() -> __f2fs_convert_inline_data() -> f2fs_reserve_block(ipage) -> get_dnode_of_data() This patch adds correct error handling codes when get_dnode_of_data() returns an error. At first, f2fs_reserve_block() calls f2fs_put_dnode() whenever reserve_new_block returns an error. So, the rule of f2fs_reserve_block() is to nullify inode page when there is any error internally. Finally, two callers of f2fs_reserve_block() should call f2fs_put_dnode() appropriately if they got an error since successful f2fs_reserve_block(). Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/inline.c')
-rw-r--r--fs/f2fs/inline.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index 2a756e57aed..688305afbc7 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -81,10 +81,9 @@ static int __f2fs_convert_inline_data(struct inode *inode, struct page *page)
* i_addr[0] is not used for inline data,
* so reserving new block will not destroy inline data
*/
- set_new_dnode(&dn, inode, ipage, ipage, 0);
+ set_new_dnode(&dn, inode, ipage, NULL, 0);
err = f2fs_reserve_block(&dn, 0);
if (err) {
- f2fs_put_page(ipage, 1);
f2fs_unlock_op(sbi);
return err;
}
@@ -111,9 +110,8 @@ static int __f2fs_convert_inline_data(struct inode *inode, struct page *page)
stat_dec_inline_inode(inode);
sync_inode_page(&dn);
- f2fs_put_page(ipage, 1);
+ f2fs_put_dnode(&dn);
f2fs_unlock_op(sbi);
-
return err;
}