提交 f1d2564a 编写于 作者: D Daeho Jeong 提交者: Jaegeuk Kim

f2fs: handle newly created page when revoking inmem pages

When committing inmem pages is successful, we revoke already committed
blocks in __revoke_inmem_pages() and finally replace the committed
ones with the old blocks using f2fs_replace_block(). However, if
the committed block was newly created one, the address of the old
block is NEW_ADDR and __f2fs_replace_block() cannot handle NEW_ADDR
as new_blkaddr properly and a kernel panic occurrs.
Signed-off-by: NDaeho Jeong <daeho.jeong@samsung.com>
Tested-by: NShu Tan <shu.tan@samsung.com>
Reviewed-by: NChao Yu <yuchao0@huawei.com>
Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
上级 7c2e5963
...@@ -248,7 +248,11 @@ static int __revoke_inmem_pages(struct inode *inode, ...@@ -248,7 +248,11 @@ static int __revoke_inmem_pages(struct inode *inode,
goto next; goto next;
} }
get_node_info(sbi, dn.nid, &ni); get_node_info(sbi, dn.nid, &ni);
f2fs_replace_block(sbi, &dn, dn.data_blkaddr, if (cur->old_addr == NEW_ADDR) {
invalidate_blocks(sbi, dn.data_blkaddr);
f2fs_update_data_blkaddr(&dn, NEW_ADDR);
} else
f2fs_replace_block(sbi, &dn, dn.data_blkaddr,
cur->old_addr, ni.version, true, true); cur->old_addr, ni.version, true, true);
f2fs_put_dnode(&dn); f2fs_put_dnode(&dn);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册