From: Chao Yu <chao@kernel.org>
To: Jaegeuk Kim <jaegeuk@kernel.org>, Zhiguo Niu <zhiguo.niu@unisoc.com>
Cc: linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, niuzhiguo84@gmail.com,
ke.wang@unisoc.com, hongyu.jin@unisoc.com
Subject: Re: [PATCH v2 4/4] f2fs: stop checkpoint when get a out-of-bounds segment
Date: Mon, 19 Feb 2024 15:14:41 +0800 [thread overview]
Message-ID: <e7d269c8-c3f2-4d86-8ac2-653912880119@kernel.org> (raw)
In-Reply-To: <ZcQdeC4e7rnr9pCr@google.com>
On 2024/2/8 8:16, Jaegeuk Kim wrote:
> On 02/07, Zhiguo Niu wrote:
>> There is low probability that an out-of-bounds segment will be got
>> on a small-capacity device. In order to prevent subsequent write requests
>> allocating block address from this invalid segment, which may cause
>> unexpected issue, stop checkpoint should be performed.
>>
>> Also introduce a new stop cp reason: STOP_CP_REASON_OUTOF_RAGNE.
>
> OUT_OF_RANGE?
Maybe STOP_CP_REASON_NO_SEGMENT will be more explicit?
Thanks,
>
>>
>> Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
>> ---
>> fs/f2fs/segment.c | 12 ++++++++++--
>> include/linux/f2fs_fs.h | 1 +
>> 2 files changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>> index 6772ad4..6fe2baf 100644
>> --- a/fs/f2fs/segment.c
>> +++ b/fs/f2fs/segment.c
>> @@ -2666,7 +2666,11 @@ static void get_new_segment(struct f2fs_sb_info *sbi,
>> if (dir == ALLOC_RIGHT) {
>> secno = find_first_zero_bit(free_i->free_secmap,
>> MAIN_SECS(sbi));
>> - f2fs_bug_on(sbi, secno >= MAIN_SECS(sbi));
>> + if (secno >= MAIN_SECS(sbi)) {
>> + f2fs_stop_checkpoint(sbi, false,
>> + STOP_CP_REASON_OUTOF_RAGNE);
>> + f2fs_bug_on(sbi, 1);
>> + }
>> } else {
>> go_left = 1;
>> left_start = hint - 1;
>> @@ -2682,7 +2686,11 @@ static void get_new_segment(struct f2fs_sb_info *sbi,
>> }
>> left_start = find_first_zero_bit(free_i->free_secmap,
>> MAIN_SECS(sbi));
>> - f2fs_bug_on(sbi, left_start >= MAIN_SECS(sbi));
>> + if (left_start >= MAIN_SECS(sbi)) {
>> + f2fs_stop_checkpoint(sbi, false,
>> + STOP_CP_REASON_OUTOF_RAGNE);
>> + f2fs_bug_on(sbi, 1);
>> + }
>> break;
>> }
>> secno = left_start;
>> diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
>> index 053137a0..72c6782 100644
>> --- a/include/linux/f2fs_fs.h
>> +++ b/include/linux/f2fs_fs.h
>> @@ -81,6 +81,7 @@ enum stop_cp_reason {
>> STOP_CP_REASON_CORRUPTED_SUMMARY,
>> STOP_CP_REASON_UPDATE_INODE,
>> STOP_CP_REASON_FLUSH_FAIL,
>> + STOP_CP_REASON_OUTOF_RAGNE,
>> STOP_CP_REASON_MAX,
>> };
>>
>> --
>> 1.9.1
next prev parent reply other threads:[~2024-02-19 7:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-07 2:01 [PATCH v2 0/4] f2fs: fix panic issue in small capacity device Zhiguo Niu
2024-02-07 2:01 ` [PATCH v2 1/4] f2fs: correct counting methods of free_segments in __set_inuse Zhiguo Niu
2024-02-07 2:01 ` [PATCH v2 2/4] f2fs: fix panic issue in update_sit_entry Zhiguo Niu
2024-02-07 2:01 ` [PATCH v2 3/4] f2fs: enhance judgment conditions of GET_SEGNO Zhiguo Niu
2024-02-07 2:01 ` [PATCH v2 4/4] f2fs: stop checkpoint when get a out-of-bounds segment Zhiguo Niu
2024-02-08 0:16 ` Jaegeuk Kim
2024-02-19 7:14 ` Chao Yu [this message]
2024-02-21 18:10 ` [f2fs-dev] [PATCH v2 0/4] f2fs: fix panic issue in small capacity device patchwork-bot+f2fs
2024-02-22 12:30 ` Chao Yu
[not found] ` <CAHJ8P3KYY27M3v=9Lu-yD2ufxU1fdG-bg=G92AbpnLUx0zLz3g@mail.gmail.com>
2024-02-23 2:38 ` Chao Yu
2024-02-26 3:25 ` Zhiguo Niu
2024-02-26 6:48 ` Chao Yu
2024-02-27 1:13 ` Jaegeuk Kim
2024-02-27 2:34 ` Zhiguo Niu
2024-02-27 17:18 ` Jaegeuk Kim
2024-02-28 1:00 ` Zhiguo Niu
2024-02-28 1:21 ` 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=e7d269c8-c3f2-4d86-8ac2-653912880119@kernel.org \
--to=chao@kernel.org \
--cc=hongyu.jin@unisoc.com \
--cc=jaegeuk@kernel.org \
--cc=ke.wang@unisoc.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=niuzhiguo84@gmail.com \
--cc=zhiguo.niu@unisoc.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
Powered by JetHome