aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/data.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2013-12-26 16:55:22 +0900
committerZiyan <jaraidaniel@gmail.com>2015-05-02 14:35:58 +0200
commit1573824706d8be00b0403f824410e3c613ab435a (patch)
tree6b7a35e5d8e168c105fd63203f14ab45bcf9f83c /fs/f2fs/data.c
parentcb57aecc6e6d9cfd418718dfe7b6d76a7b7d802b (diff)
downloadkernel_samsung_tuna-1573824706d8be00b0403f824410e3c613ab435a.zip
kernel_samsung_tuna-1573824706d8be00b0403f824410e3c613ab435a.tar.gz
kernel_samsung_tuna-1573824706d8be00b0403f824410e3c613ab435a.tar.bz2
f2fs: should put the dnode when NEW_ADDR is detected
When get_dnode_of_data() in get_data_block() returns a successful dnode, we should put the dnode. But, previously, if its data block address is equal to NEW_ADDR, we didn't do that, resulting in a deadlock condition. So, this patch splits original error conditions with this case, and then calls f2fs_put_dnode before finishing the function. Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/data.c')
-rw-r--r--fs/f2fs/data.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index ebb3004..53664d1 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -625,11 +625,13 @@ static int get_data_block(struct inode *inode, sector_t iblock,
/* When reading holes, we need its node page */
set_new_dnode(&dn, inode, NULL, NULL, 0);
err = get_dnode_of_data(&dn, pgofs, mode);
- if (err || dn.data_blkaddr == NEW_ADDR) {
+ if (err) {
if (err == -ENOENT)
err = 0;
goto unlock_out;
}
+ if (dn.data_blkaddr == NEW_ADDR)
+ goto put_out;
if (dn.data_blkaddr != NULL_ADDR) {
map_bh(bh_result, inode->i_sb, dn.data_blkaddr);
@@ -658,11 +660,14 @@ get_next:
set_new_dnode(&dn, inode, NULL, NULL, 0);
err = get_dnode_of_data(&dn, pgofs, mode);
- if (err || dn.data_blkaddr == NEW_ADDR) {
+ if (err) {
if (err == -ENOENT)
err = 0;
goto unlock_out;
}
+ if (dn.data_blkaddr == NEW_ADDR)
+ goto put_out;
+
end_offset = IS_INODE(dn.node_page) ?
ADDRS_PER_INODE(F2FS_I(inode)) : ADDRS_PER_BLOCK;
}