lkml.org 
[lkml]   [2014]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] f2fs: Fix recover when nid of non-inode dnode < nid of inode
Hi Huang,

On Mon, Sep 08, 2014 at 07:38:26PM +0800, Huang Ying wrote:
> For fsync, if the nid of a non-inode dnode < nid of inode and the
> inode is not checkpointed. The non-inode dnode may be written before
> inode. So in find_fsync_dnodes, f2fs_iget will fail, cause the
> recovery fail.
>
> Usually, inode will be allocated before non-inode dnode, so the nid of
> inode < nid of non-inode dnode. But it is possible for the reverse.
> For example, because of alloc_nid_failed.
>
> This is fixed via ignoring non-inode dnode before inode dnode in
> find_fsync_dnodes.
>
> The patch was tested via allocating nid reversely via a debugging
> patch, that is, from big number to small number.
>
> Signed-off-by: Huang, Ying <ying.huang@intel.com>
> ---
> fs/f2fs/recovery.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> --- a/fs/f2fs/recovery.c
> +++ b/fs/f2fs/recovery.c
> @@ -172,8 +172,8 @@ static int find_fsync_dnodes(struct f2fs
> if (IS_INODE(page) && is_dent_dnode(page))
> set_inode_flag(F2FS_I(entry->inode),
> FI_INC_LINK);
> - } else {
> - if (IS_INODE(page) && is_dent_dnode(page)) {

If this is not inode block, we should add this inode to recover its data blocks.
Rather than this tweak, if iget is failed, we'd better go to next instead of
break.
Can you test that?

> + } else if (IS_INODE(page)) {
> + if (is_dent_dnode(page)) {
> err = recover_inode_page(sbi, page);
> if (err)
> break;
> @@ -193,7 +193,8 @@ static int find_fsync_dnodes(struct f2fs
> break;
> }
> list_add_tail(&entry->list, head);
> - }
> + } else
> + goto next;
> entry->blkaddr = blkaddr;
>
> err = recover_inode(entry->inode, page);


\
 
 \ /
  Last update: 2014-09-09 08:01    [W:0.075 / U:1.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site