public inbox for linux-raid@vger.kernel.org
 help / color / mirror / Atom feed
From: "Yu Kuai" <yukuai@fnnas.com>
To: <linan666@huaweicloud.com>, <song@kernel.org>, <neil@brown.name>,
	 <namhyung@gmail.com>
Cc: <linux-raid@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	 <xni@redhat.com>, <k@mgml.me>, <yangerkun@huawei.com>,
	 <yi.zhang@huawei.com>, <yukuai@fnnas.com>
Subject: Re: [PATCH v2 06/11] md: remove MD_RECOVERY_ERROR handling and simplify resync_offset update
Date: Sat, 8 Nov 2025 18:22:32 +0800	[thread overview]
Message-ID: <c4b15e44-bb02-415e-8f7f-75db2ae2edca@fnnas.com> (raw)
In-Reply-To: <20251106115935.2148714-7-linan666@huaweicloud.com>

Hi,

在 2025/11/6 19:59, linan666@huaweicloud.com 写道:
> From: Li Nan <linan122@huawei.com>
>
> When sync IO failed and setting badblock also failed, unsynced disk
> might be kicked via setting 'recovery_disable' without Faulty flag.
> MD_RECOVERY_ERROR was set in md_sync_error() to prevent updating
> 'resync_offset', avoiding reading the failed sync sectors.
>
> Previous patch ensures disk is marked Faulty when badblock setting fails.
> Remove MD_RECOVERY_ERROR handling as it's no longer needed - failed sync
> sectors are unreadable either via badblock or Faulty disk.
>
> Simplify resync_offset update logic.
>
> Signed-off-by: Li Nan <linan122@huawei.com>
> ---
>   drivers/md/md.h |  2 --
>   drivers/md/md.c | 23 +++++------------------
>   2 files changed, 5 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/md/md.h b/drivers/md/md.h
> index 18621dba09a9..c5b5377e9049 100644
> --- a/drivers/md/md.h
> +++ b/drivers/md/md.h
> @@ -644,8 +644,6 @@ enum recovery_flags {
>   	MD_RECOVERY_FROZEN,
>   	/* waiting for pers->start() to finish */
>   	MD_RECOVERY_WAIT,
> -	/* interrupted because io-error */
> -	MD_RECOVERY_ERROR,
>   
>   	/* flags determines sync action, see details in enum sync_action */
>   
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 2bdbb5b0e9e1..71988d8f5154 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -8949,7 +8949,6 @@ void md_sync_error(struct mddev *mddev)
>   {
>   	// stop recovery, signal do_sync ....
>   	set_bit(MD_RECOVERY_INTR, &mddev->recovery);
> -	set_bit(MD_RECOVERY_ERROR, &mddev->recovery);
>   	md_wakeup_thread(mddev->thread);
>   }
>   EXPORT_SYMBOL(md_sync_error);
> @@ -9603,8 +9602,8 @@ void md_do_sync(struct md_thread *thread)
>   	wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active));
>   
>   	if (!test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery) &&
> -	    !test_bit(MD_RECOVERY_INTR, &mddev->recovery) &&

Why the above checking is removed?

Thanks,
Kuai

>   	    mddev->curr_resync >= MD_RESYNC_ACTIVE) {
> +		/* All sync IO completes after recovery_active becomes 0 */
>   		mddev->curr_resync_completed = mddev->curr_resync;
>   		sysfs_notify_dirent_safe(mddev->sysfs_completed);
>   	}
> @@ -9612,24 +9611,12 @@ void md_do_sync(struct md_thread *thread)
>   
>   	if (!test_bit(MD_RECOVERY_CHECK, &mddev->recovery) &&
>   	    mddev->curr_resync > MD_RESYNC_ACTIVE) {
> +		if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery))
> +			mddev->curr_resync = MaxSector;
> +
>   		if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) {
> -			if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) {
> -				if (mddev->curr_resync >= mddev->resync_offset) {
> -					pr_debug("md: checkpointing %s of %s.\n",
> -						 desc, mdname(mddev));
> -					if (test_bit(MD_RECOVERY_ERROR,
> -						&mddev->recovery))
> -						mddev->resync_offset =
> -							mddev->curr_resync_completed;
> -					else
> -						mddev->resync_offset =
> -							mddev->curr_resync;
> -				}
> -			} else
> -				mddev->resync_offset = MaxSector;
> +			mddev->resync_offset = mddev->curr_resync;
>   		} else {
> -			if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery))
> -				mddev->curr_resync = MaxSector;
>   			if (!test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery) &&
>   			    test_bit(MD_RECOVERY_RECOVER, &mddev->recovery)) {
>   				rcu_read_lock();

  reply	other threads:[~2025-11-08 10:22 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-06 11:59 [PATCH v2 00/11] cleanup and bugfix of sync linan666
2025-11-06 11:59 ` [PATCH v2 01/11] md/raid1: simplify uptodate handling in end_sync_write linan666
2025-11-08 10:02   ` Yu Kuai
2025-11-06 11:59 ` [PATCH v2 02/11] md: factor error handling out of md_done_sync into helper linan666
2025-11-06 11:59 ` [PATCH v2 03/11] md/raid1,raid10: return actual write status in narrow_write_error linan666
2025-11-08 10:07   ` Yu Kuai
2025-11-10 11:56     ` Li Nan
2025-11-28  2:45       ` Yu Kuai
2025-11-06 11:59 ` [PATCH v2 04/11] md/raid1,raid10: support narrow_write_error when badblocks is disabled linan666
2025-11-08 10:11   ` Yu Kuai
2025-11-06 11:59 ` [PATCH v2 05/11] md: mark rdev Faulty when badblocks setting fails linan666
2025-11-08 10:15   ` Yu Kuai
2025-11-06 11:59 ` [PATCH v2 06/11] md: remove MD_RECOVERY_ERROR handling and simplify resync_offset update linan666
2025-11-08 10:22   ` Yu Kuai [this message]
2025-11-10 12:17     ` Li Nan
2025-11-28  2:47       ` Yu Kuai
2025-11-06 11:59 ` [PATCH v2 07/11] md: factor out sync completion update into helper linan666
2025-11-08 10:30   ` Yu Kuai
2025-11-06 11:59 ` [PATCH v2 08/11] md: move finish_reshape to md_finish_sync() linan666
2025-11-08 10:37   ` Yu Kuai
2025-11-06 11:59 ` [PATCH v2 09/11] md/raid10: fix any_working flag handling in raid10_sync_request linan666
2025-11-06 11:59 ` [PATCH v2 10/11] md/raid10: cleanup skip " linan666
2025-11-08 10:54   ` Yu Kuai
2025-11-06 11:59 ` [PATCH v2 11/11] md: remove recovery_disabled linan666

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=c4b15e44-bb02-415e-8f7f-75db2ae2edca@fnnas.com \
    --to=yukuai@fnnas.com \
    --cc=k@mgml.me \
    --cc=linan666@huaweicloud.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=namhyung@gmail.com \
    --cc=neil@brown.name \
    --cc=song@kernel.org \
    --cc=xni@redhat.com \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox