diff options
author | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-12-27 09:04:17 +0100 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-01-06 08:42:21 +0100 |
commit | a8865372a8414298982e07f4ac8d6dc0ab1e0a3d (patch) | |
tree | d854711c56be4c135701610710c0fda95a297d13 /fs/f2fs/dir.c | |
parent | f2fs: add inline_data recovery routine (diff) | |
download | linux-a8865372a8414298982e07f4ac8d6dc0ab1e0a3d.tar.xz linux-a8865372a8414298982e07f4ac8d6dc0ab1e0a3d.zip |
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/dir.c')
-rw-r--r-- | fs/f2fs/dir.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 6da77e5c753b..f815ca0c5819 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -342,11 +342,11 @@ static struct page *init_inode_metadata(struct inode *inode, err = f2fs_init_acl(inode, dir, page); if (err) - goto error; + goto put_error; err = f2fs_init_security(inode, dir, name, page); if (err) - goto error; + goto put_error; wait_on_page_writeback(page); } else { @@ -370,8 +370,9 @@ static struct page *init_inode_metadata(struct inode *inode, } return page; -error: +put_error: f2fs_put_page(page, 1); +error: remove_inode_page(inode); return ERR_PTR(err); } |