All of lore.kernel.org
 help / color / mirror / Atom feed
From: heyunlei <heyunlei@huawei.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <yuchao0@huawei.com>
Cc: <linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-f2fs-devel@lists.sourceforge.net>
Subject: Re: [f2fs-dev] [PATCH 1/5] f2fs: relax node version check for victim data in gc
Date: Wed, 29 Mar 2017 15:04:30 +0800	[thread overview]
Message-ID: <3179fe9f-5d40-76f9-4852-3990792f226c@huawei.com> (raw)
In-Reply-To: <20170325212742.GA24857@jaegeuk.local>

Hi all,

On 2017/3/26 5:27, Jaegeuk Kim wrote:
> On 03/25, Chao Yu wrote:
>> Hi Jaegeuk,
>>
>> On 2017/3/25 15:59, Jaegeuk Kim wrote:
>>> - has_not_enough_free_secs
>>> node_secs: 0  dent_secs: 0  freed:0  free_segments:103  reserved:104
>>>
>>>           - f2fs_gc
>>>              - get_victim_by_default
>>> alloc_mode 0, gc_mode 1, max_search 2672, offset 4654, ofs_unit 1
>>>
>>>                 - do_garbage_collect
>>> start_segno 3976, end_segno 3977   type 0
>>>
>>>                   - is_alive
>>> nid 22797, blkaddr 2131882, ofs_in_node 0, version 0x8/0x0
>>>
>>>                    - gc_data_segment 766, segno 3976, block 512/426 not alive
>>>
>>> So, this patch fixes subtle corrupted case where node version does not match
>>> to summary version which results in infinite loop by gc.
>>>
>>> Reported-by: Yunlei He <heyunlei@huawei.com>
>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>>> ---
>>>  fs/f2fs/gc.c | 6 ++++--
>>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
>>> index 939be88a8833..bbeee41aaf73 100644
>>> --- a/fs/f2fs/gc.c
>>> +++ b/fs/f2fs/gc.c
>>> @@ -551,8 +551,10 @@ static bool is_alive(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
>>>  	get_node_info(sbi, nid, dni);
>>>
>>>  	if (sum->version != dni->version) {
>>
>> If the node was been truncated, we will increase its version number, since it
>> was been truncated, so it will never be writebacked to storage, so the version
>> in summary will not be updated.
>

The same problem I came across with a node segment:

481                 get_node_info(sbi, nid, &ni);
482                 if (ni.blk_addr != start_addr + off) {
483                         f2fs_put_page(node_page, 1);
484                         continue;
485                 }

Here, get victim method always selected segno 5169 for garbage collection,

but this section gc failed for upper condition:

	gc_node_segment 494, blk_addr 1697572,start_addr 2668544,off 200

I think is same problem with is_alive function.

Thanks.


> That's covered by node page lock, so we shouldn't be reached out to this point.
> Let's think more about this.
>
> Thanks,
>
>> So this case can happen, shouldn't we just set SBI_NEED_FSCK for the case:
>> sum->version != dni->version - 1
>>
>> Thanks,
>>
>>> -		f2fs_put_page(node_page, 1);
>>> -		return false;
>>> +		f2fs_msg(sbi->sb, KERN_WARNING,
>>> +				"%s: valid data with mismatched node version.",
>>> +				__func__);
>>> +		set_sbi_flag(sbi, SBI_NEED_FSCK);
>>>  	}
>>>
>>>  	*nofs = ofs_of_node(node_page);
>>>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
>
> .
>

WARNING: multiple messages have this Message-ID (diff)
From: heyunlei <heyunlei@huawei.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <yuchao0@huawei.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/5] f2fs: relax node version check for victim data in gc
Date: Wed, 29 Mar 2017 15:04:30 +0800	[thread overview]
Message-ID: <3179fe9f-5d40-76f9-4852-3990792f226c@huawei.com> (raw)
In-Reply-To: <20170325212742.GA24857@jaegeuk.local>

Hi all,

On 2017/3/26 5:27, Jaegeuk Kim wrote:
> On 03/25, Chao Yu wrote:
>> Hi Jaegeuk,
>>
>> On 2017/3/25 15:59, Jaegeuk Kim wrote:
>>> - has_not_enough_free_secs
>>> node_secs: 0  dent_secs: 0  freed:0  free_segments:103  reserved:104
>>>
>>>           - f2fs_gc
>>>              - get_victim_by_default
>>> alloc_mode 0, gc_mode 1, max_search 2672, offset 4654, ofs_unit 1
>>>
>>>                 - do_garbage_collect
>>> start_segno 3976, end_segno 3977   type 0
>>>
>>>                   - is_alive
>>> nid 22797, blkaddr 2131882, ofs_in_node 0, version 0x8/0x0
>>>
>>>                    - gc_data_segment 766, segno 3976, block 512/426 not alive
>>>
>>> So, this patch fixes subtle corrupted case where node version does not match
>>> to summary version which results in infinite loop by gc.
>>>
>>> Reported-by: Yunlei He <heyunlei@huawei.com>
>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>>> ---
>>>  fs/f2fs/gc.c | 6 ++++--
>>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
>>> index 939be88a8833..bbeee41aaf73 100644
>>> --- a/fs/f2fs/gc.c
>>> +++ b/fs/f2fs/gc.c
>>> @@ -551,8 +551,10 @@ static bool is_alive(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
>>>  	get_node_info(sbi, nid, dni);
>>>
>>>  	if (sum->version != dni->version) {
>>
>> If the node was been truncated, we will increase its version number, since it
>> was been truncated, so it will never be writebacked to storage, so the version
>> in summary will not be updated.
>

The same problem I came across with a node segment:

481                 get_node_info(sbi, nid, &ni);
482                 if (ni.blk_addr != start_addr + off) {
483                         f2fs_put_page(node_page, 1);
484                         continue;
485                 }

Here, get victim method always selected segno 5169 for garbage collection,

but this section gc failed for upper condition:

	gc_node_segment 494, blk_addr 1697572,start_addr 2668544,off 200

I think is same problem with is_alive function.

Thanks.


> That's covered by node page lock, so we shouldn't be reached out to this point.
> Let's think more about this.
>
> Thanks,
>
>> So this case can happen, shouldn't we just set SBI_NEED_FSCK for the case:
>> sum->version != dni->version - 1
>>
>> Thanks,
>>
>>> -		f2fs_put_page(node_page, 1);
>>> -		return false;
>>> +		f2fs_msg(sbi->sb, KERN_WARNING,
>>> +				"%s: valid data with mismatched node version.",
>>> +				__func__);
>>> +		set_sbi_flag(sbi, SBI_NEED_FSCK);
>>>  	}
>>>
>>>  	*nofs = ofs_of_node(node_page);
>>>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
>
> .
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  parent reply	other threads:[~2017-03-29  7:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-25  7:59 [PATCH 1/5] f2fs: relax node version check for victim data in gc Jaegeuk Kim
2017-03-25  7:59 ` [PATCH 2/5] f2fs: write small sized IO to hot log Jaegeuk Kim
2017-03-25  7:59   ` Jaegeuk Kim
2017-03-25  7:59 ` [PATCH 3/5] f2fs: allocate node and hot data in the beginning of partition Jaegeuk Kim
2017-03-25  7:59   ` Jaegeuk Kim
2017-03-25  7:59 ` [PATCH 4/5] f2fs: start SSR much eariler to avoid FG_GC Jaegeuk Kim
2017-03-25  7:59   ` Jaegeuk Kim
2017-03-25  7:59 ` [PATCH 5/5] f2fs: fix wrong max cost initialization Jaegeuk Kim
2017-03-25  7:59   ` Jaegeuk Kim
2017-03-25  9:05 ` [f2fs-dev] [PATCH 1/5] f2fs: relax node version check for victim data in gc Chao Yu
2017-03-25  9:05   ` Chao Yu
2017-03-25 21:27   ` [f2fs-dev] " Jaegeuk Kim
2017-03-25 21:27     ` Jaegeuk Kim
2017-03-27  8:18     ` [f2fs-dev] " Chao Yu
2017-03-27  8:18       ` Chao Yu
2017-03-29  7:04     ` heyunlei [this message]
2017-03-29  7:04       ` heyunlei

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=3179fe9f-5d40-76f9-4852-3990792f226c@huawei.com \
    --to=heyunlei@huawei.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yuchao0@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.