mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Yunlong Song <yunlong.song@huawei.com>
Cc: chao@kernel.org, yuchao0@huawei.com, yunlong.song@icloud.com,
	miaoxie@huawei.com, bintian.wang@huawei.com,
	shengyong1@huawei.com, heyunlei@huawei.com,
	linux-fsdevel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] f2fs: check segment type in __f2fs_replace_block
Date: Wed, 3 Jan 2018 23:10:54 -0800	[thread overview]
Message-ID: <20180104071054.GD54234@jaegeuk-macbookpro.roam.corp.google.com> (raw)
In-Reply-To: <1515049322-29555-1-git-send-email-yunlong.song@huawei.com>

On 01/04, Yunlong Song wrote:
> In some case, the node blocks has wrong blkaddr whose segment type is
> NODE, e.g., recover inode has missing xattr flag and the blkaddr is in
> the xattr range. Since fsck.f2fs does not check the recovery nodes, this
> will cause __f2fs_replace_block change the curseg of node and do the
> update_sit_entry(sbi, new_blkaddr, 1) with no next_blkoff refresh, as a
> result, when recovery process write checkpoint and sync nodes, the
> next_blkoff of curseg is used in the segment bit map, then it will
> cause f2fs_bug_on. So let's check segment type in __f2fs_replace_block.
> 
> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
> ---
>  fs/f2fs/segment.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 890d483..50575d5 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -2720,6 +2720,7 @@ void __f2fs_replace_block(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
>  	type = se->type;
>  
>  	down_write(&SM_I(sbi)->curseg_lock);
> +	f2fs_bug_on(sbi, se->valid_blocks && !IS_DATASEG(type));

Let me just move this below like this and start some tests.

...

+       f2fs_bug_on(sbi, !IS_DATASEG(type));
        curseg = CURSEG_I(sbi, type);

>  
>  	if (!recover_curseg) {
>  		/* for recovery flow */
> -- 
> 1.8.5.2

  reply	other threads:[~2018-01-04  7:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-30  7:42 [PATCH] f2fs: check segment type before recover data Yunlong Song
2018-01-02  6:49 ` Chao Yu
2018-01-02 11:02   ` Yunlong Song
2018-01-04  1:38     ` Chao Yu
2018-01-03 20:04 ` Jaegeuk Kim
2018-01-04  3:48 ` [PATCH v2] f2fs: check segment type in __f2fs_replace_block Yunlong Song
2018-01-04  5:56   ` Chao Yu
2018-01-04  6:24 ` [PATCH v3] " Yunlong Song
2018-01-04  6:54   ` Jaegeuk Kim
2018-01-04  7:02 ` [PATCH v4] " Yunlong Song
2018-01-04  7:10   ` Jaegeuk Kim [this message]
2018-01-04  7:22     ` Chao Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180104071054.GD54234@jaegeuk-macbookpro.roam.corp.google.com \
    --to=jaegeuk@kernel.org \
    --cc=bintian.wang@huawei.com \
    --cc=chao@kernel.org \
    --cc=heyunlei@huawei.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miaoxie@huawei.com \
    --cc=shengyong1@huawei.com \
    --cc=yuchao0@huawei.com \
    --cc=yunlong.song@huawei.com \
    --cc=yunlong.song@icloud.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®