diff options
author | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-12-26 02:55:22 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-12-26 06:33:06 -0500 |
commit | 1ec79083b2d4614d9dbaea67b5f55b60d7137a2d (patch) | |
tree | 2b3ddcae1dade70d1e18c806c603269c09019852 /fs/f2fs | |
parent | 58bfaf44df58082c72882b235cae611c975537d4 (diff) |
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')
-rw-r--r-- | fs/f2fs/data.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 0879d2aa97e6..991e36835df8 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c | |||
@@ -626,11 +626,13 @@ static int get_data_block(struct inode *inode, sector_t iblock, | |||
626 | /* When reading holes, we need its node page */ | 626 | /* When reading holes, we need its node page */ |
627 | set_new_dnode(&dn, inode, NULL, NULL, 0); | 627 | set_new_dnode(&dn, inode, NULL, NULL, 0); |
628 | err = get_dnode_of_data(&dn, pgofs, mode); | 628 | err = get_dnode_of_data(&dn, pgofs, mode); |
629 | if (err || dn.data_blkaddr == NEW_ADDR) { | 629 | if (err) { |
630 | if (err == -ENOENT) | 630 | if (err == -ENOENT) |
631 | err = 0; | 631 | err = 0; |
632 | goto unlock_out; | 632 | goto unlock_out; |
633 | } | 633 | } |
634 | if (dn.data_blkaddr == NEW_ADDR) | ||
635 | goto put_out; | ||
634 | 636 | ||
635 | if (dn.data_blkaddr != NULL_ADDR) { | 637 | if (dn.data_blkaddr != NULL_ADDR) { |
636 | map_bh(bh_result, inode->i_sb, dn.data_blkaddr); | 638 | map_bh(bh_result, inode->i_sb, dn.data_blkaddr); |
@@ -659,11 +661,14 @@ get_next: | |||
659 | 661 | ||
660 | set_new_dnode(&dn, inode, NULL, NULL, 0); | 662 | set_new_dnode(&dn, inode, NULL, NULL, 0); |
661 | err = get_dnode_of_data(&dn, pgofs, mode); | 663 | err = get_dnode_of_data(&dn, pgofs, mode); |
662 | if (err || dn.data_blkaddr == NEW_ADDR) { | 664 | if (err) { |
663 | if (err == -ENOENT) | 665 | if (err == -ENOENT) |
664 | err = 0; | 666 | err = 0; |
665 | goto unlock_out; | 667 | goto unlock_out; |
666 | } | 668 | } |
669 | if (dn.data_blkaddr == NEW_ADDR) | ||
670 | goto put_out; | ||
671 | |||
667 | end_offset = IS_INODE(dn.node_page) ? | 672 | end_offset = IS_INODE(dn.node_page) ? |
668 | ADDRS_PER_INODE(F2FS_I(inode)) : ADDRS_PER_BLOCK; | 673 | ADDRS_PER_INODE(F2FS_I(inode)) : ADDRS_PER_BLOCK; |
669 | } | 674 | } |