All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Zhiguo Niu <zhiguo.niu@unisoc.com>
Cc: ke.wang@unisoc.com, linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net, hongyu.jin@unisoc.com,
	niuzhiguo84@gmail.com
Subject: Re: [f2fs-dev] [PATCH v2 4/4] f2fs: stop checkpoint when get a out-of-bounds segment
Date: Wed, 7 Feb 2024 16:16:56 -0800	[thread overview]
Message-ID: <ZcQdeC4e7rnr9pCr@google.com> (raw)
In-Reply-To: <1707271264-5551-5-git-send-email-zhiguo.niu@unisoc.com>

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?

> 
> 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


_______________________________________________
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: Jaegeuk Kim <jaegeuk@kernel.org>
To: Zhiguo Niu <zhiguo.niu@unisoc.com>
Cc: chao@kernel.org, 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: Wed, 7 Feb 2024 16:16:56 -0800	[thread overview]
Message-ID: <ZcQdeC4e7rnr9pCr@google.com> (raw)
In-Reply-To: <1707271264-5551-5-git-send-email-zhiguo.niu@unisoc.com>

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?

> 
> 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

  reply	other threads:[~2024-02-08  0:17 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07  2:01 [f2fs-dev] [PATCH v2 0/4] f2fs: fix panic issue in small capacity device Zhiguo Niu
2024-02-07  2:01 ` Zhiguo Niu
2024-02-07  2:01 ` [f2fs-dev] [PATCH v2 1/4] f2fs: correct counting methods of free_segments in __set_inuse Zhiguo Niu
2024-02-07  2:01   ` Zhiguo Niu
2024-02-07  2:01 ` [f2fs-dev] [PATCH v2 2/4] f2fs: fix panic issue in update_sit_entry Zhiguo Niu
2024-02-07  2:01   ` Zhiguo Niu
2024-02-07  2:01 ` [f2fs-dev] [PATCH v2 3/4] f2fs: enhance judgment conditions of GET_SEGNO Zhiguo Niu
2024-02-07  2:01   ` Zhiguo Niu
2024-02-07  2:01 ` [f2fs-dev] [PATCH v2 4/4] f2fs: stop checkpoint when get a out-of-bounds segment Zhiguo Niu
2024-02-07  2:01   ` Zhiguo Niu
2024-02-08  0:16   ` Jaegeuk Kim [this message]
2024-02-08  0:16     ` Jaegeuk Kim
2024-02-19  7:14     ` [f2fs-dev] " Chao Yu
2024-02-19  7:14       ` Chao Yu
2024-02-21 18:10 ` [f2fs-dev] [PATCH v2 0/4] f2fs: fix panic issue in small capacity device patchwork-bot+f2fs
2024-02-21 18:10   ` patchwork-bot+f2fs
2024-02-22 12:30 ` Chao Yu
2024-02-22 12:30   ` Chao Yu
     [not found]   ` <CAHJ8P3KYY27M3v=9Lu-yD2ufxU1fdG-bg=G92AbpnLUx0zLz3g@mail.gmail.com>
2024-02-23  2:38     ` [f2fs-dev] " Chao Yu
2024-02-23  2:38       ` Chao Yu
2024-02-26  3:25       ` [f2fs-dev] " Zhiguo Niu
2024-02-26  3:25         ` Zhiguo Niu
2024-02-26  6:48         ` [f2fs-dev] " Chao Yu
2024-02-26  6:48           ` Chao Yu
2024-02-27  1:13         ` [f2fs-dev] " Jaegeuk Kim
2024-02-27  1:13           ` Jaegeuk Kim
2024-02-27  2:34           ` [f2fs-dev] " Zhiguo Niu
2024-02-27  2:34             ` Zhiguo Niu
2024-02-27 17:18             ` [f2fs-dev] " Jaegeuk Kim
2024-02-27 17:18               ` Jaegeuk Kim
2024-02-28  1:00               ` [f2fs-dev] " Zhiguo Niu
2024-02-28  1:00                 ` Zhiguo Niu
2024-02-28  1:21               ` [f2fs-dev] " Chao Yu
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=ZcQdeC4e7rnr9pCr@google.com \
    --to=jaegeuk@kernel.org \
    --cc=hongyu.jin@unisoc.com \
    --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 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.