mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-25 08:02:56 +00:00
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>
This commit is contained in:
parent
58bfaf44df
commit
1ec79083b2
1 changed files with 7 additions and 2 deletions
|
@ -626,11 +626,13 @@ static int get_data_block(struct inode *inode, sector_t iblock,
|
||||||
/* When reading holes, we need its node page */
|
/* When reading holes, we need its node page */
|
||||||
set_new_dnode(&dn, inode, NULL, NULL, 0);
|
set_new_dnode(&dn, inode, NULL, NULL, 0);
|
||||||
err = get_dnode_of_data(&dn, pgofs, mode);
|
err = get_dnode_of_data(&dn, pgofs, mode);
|
||||||
if (err || dn.data_blkaddr == NEW_ADDR) {
|
if (err) {
|
||||||
if (err == -ENOENT)
|
if (err == -ENOENT)
|
||||||
err = 0;
|
err = 0;
|
||||||
goto unlock_out;
|
goto unlock_out;
|
||||||
}
|
}
|
||||||
|
if (dn.data_blkaddr == NEW_ADDR)
|
||||||
|
goto put_out;
|
||||||
|
|
||||||
if (dn.data_blkaddr != NULL_ADDR) {
|
if (dn.data_blkaddr != NULL_ADDR) {
|
||||||
map_bh(bh_result, inode->i_sb, dn.data_blkaddr);
|
map_bh(bh_result, inode->i_sb, dn.data_blkaddr);
|
||||||
|
@ -659,11 +661,14 @@ get_next:
|
||||||
|
|
||||||
set_new_dnode(&dn, inode, NULL, NULL, 0);
|
set_new_dnode(&dn, inode, NULL, NULL, 0);
|
||||||
err = get_dnode_of_data(&dn, pgofs, mode);
|
err = get_dnode_of_data(&dn, pgofs, mode);
|
||||||
if (err || dn.data_blkaddr == NEW_ADDR) {
|
if (err) {
|
||||||
if (err == -ENOENT)
|
if (err == -ENOENT)
|
||||||
err = 0;
|
err = 0;
|
||||||
goto unlock_out;
|
goto unlock_out;
|
||||||
}
|
}
|
||||||
|
if (dn.data_blkaddr == NEW_ADDR)
|
||||||
|
goto put_out;
|
||||||
|
|
||||||
end_offset = IS_INODE(dn.node_page) ?
|
end_offset = IS_INODE(dn.node_page) ?
|
||||||
ADDRS_PER_INODE(F2FS_I(inode)) : ADDRS_PER_BLOCK;
|
ADDRS_PER_INODE(F2FS_I(inode)) : ADDRS_PER_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue