Linux RAID subsystem development
 help / color / mirror / Atom feed
From: "Yu Kuai" <yukuai@fnnas.com>
To: "Benjamin Marzinski" <bmarzins@redhat.com>,
	 "Yang Xiuwei" <yangxiuwei@kylinos.cn>
Cc: "Yu Kuai"
	<yukuai@alb-78bjiv52429oh8qptp.cn-shenzhen.alb.aliyuncs.com>,
	 "Li Nan" <linan666@huaweicloud.com>,
	"Song Liu" <song@kernel.org>,  <linux-raid@vger.kernel.org>,
	<dm-devel@lists.linux.dev>,  "Xiao Ni" <xni@redhat.com>,
	"Nigel Croxon" <ncroxon@redhat.com>,  <yukuai@fnnas.com>
Subject: Re: [RFC PATCH] dm-raid: only requeue bios when dm is suspending.
Date: Tue, 28 Apr 2026 16:35:52 +0800	[thread overview]
Message-ID: <e98037c0-de70-4de4-b3ea-e2d67022a7fc@fnnas.com> (raw)
In-Reply-To: <20260414190350.1946406-1-bmarzins@redhat.com>

Hi,

在 2026/4/15 3:03, Benjamin Marzinski 写道:
> returning DM_MAPIO_REQUEUE from the target map() function only requeues
> the bio during noflush suspends. During regular operations or during
> flushing suspends, it fails the bio. Failing the bio during flushing
> suspends is the correct behavior here. We cannot handle the bio, and we
> cannot suspends while it is outstanding. But during normal operations,
> we should not push the bio back to do. Instead, wait for the reshape
> to be resumed.
>
> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>
> Yang Xiuwei, if you are still able to see I/O errors during LVM testing,
> does this patch fix them?
>
>   drivers/md/dm-raid.c | 7 +++++++
>   drivers/md/md.h      | 1 +
>   drivers/md/raid5.c   | 6 ++++--
>   3 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
> index 4bacdc499984..cac61d57e7e2 100644
> --- a/drivers/md/dm-raid.c
> +++ b/drivers/md/dm-raid.c
> @@ -3831,6 +3831,7 @@ static void raid_presuspend(struct dm_target *ti)
>   	 * resume, raid_postsuspend() is too late.
>   	 */
>   	set_bit(RT_FLAG_RS_FROZEN, &rs->runtime_flags);
> +	WRITE_ONCE(mddev->dm_suspending, 1);
>   
>   	if (!reshape_interrupted(mddev))
>   		return;
> @@ -3847,6 +3848,9 @@ static void raid_presuspend(struct dm_target *ti)
>   static void raid_presuspend_undo(struct dm_target *ti)
>   {
>   	struct raid_set *rs = ti->private;
> +	struct mddev *mddev = &rs->md;
> +
> +	WRITE_ONCE(mddev->dm_suspending, 0);
>   
>   	clear_bit(RT_FLAG_RS_FROZEN, &rs->runtime_flags);
>   }
> @@ -3854,6 +3858,7 @@ static void raid_presuspend_undo(struct dm_target *ti)
>   static void raid_postsuspend(struct dm_target *ti)
>   {
>   	struct raid_set *rs = ti->private;
> +	struct mddev *mddev = &rs->md;
>   
>   	if (!test_and_set_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags)) {
>   		/*
> @@ -3864,6 +3869,8 @@ static void raid_postsuspend(struct dm_target *ti)
>   		mddev_suspend(&rs->md, false);
>   		rs->md.ro = MD_RDONLY;
>   	}
> +	WRITE_ONCE(mddev->dm_suspending, 0);
> +
>   }
>   
>   static void attempt_restore_of_faulty_devices(struct raid_set *rs)
> diff --git a/drivers/md/md.h b/drivers/md/md.h
> index ac84289664cd..e8d7332c5cb9 100644
> --- a/drivers/md/md.h
> +++ b/drivers/md/md.h
> @@ -463,6 +463,7 @@ struct mddev {
>   	int				delta_disks, new_level, new_layout;
>   	int				new_chunk_sectors;
>   	int				reshape_backwards;
> +	int				dm_suspending;

This patch looks fine, however, can you also optimize it by a new
flag instead a new int field ?

>   
>   	struct md_thread __rcu		*thread;	/* management thread */
>   	struct md_thread __rcu		*sync_thread;	/* doing resync or reconstruct */
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 8854e024f311..d528263f92a3 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -6042,8 +6042,10 @@ static enum stripe_result make_stripe_request(struct mddev *mddev,
>   	raid5_release_stripe(sh);
>   out:
>   	if (ret == STRIPE_SCHEDULE_AND_RETRY && reshape_interrupted(mddev)) {
> -		bi->bi_status = BLK_STS_RESOURCE;
> -		ret = STRIPE_WAIT_RESHAPE;
> +		if (!mddev_is_dm(mddev) || READ_ONCE(mddev->dm_suspending)) {
> +			bi->bi_status = BLK_STS_RESOURCE;
> +			ret = STRIPE_WAIT_RESHAPE;
> +		}
>   		pr_err_ratelimited("dm-raid456: io across reshape position while reshape can't make progress");
>   	}
>   	return ret;

-- 
Thansk,
Kuai

  parent reply	other threads:[~2026-04-28  8:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-13 22:45 [PATCH] md/raid5: Don't set bi_status on STRIPE_WAIT_RESHAPE Benjamin Marzinski
2026-04-14  1:25 ` Li Nan
2026-04-14  6:20   ` Yu Kuai
2026-04-14 18:19     ` Benjamin Marzinski
2026-04-14 19:03       ` [RFC PATCH] dm-raid: only requeue bios when dm is suspending Benjamin Marzinski
2026-04-22  9:58         ` Xiao Ni
2026-04-28  8:35         ` Yu Kuai [this message]
2026-04-15  1:28       ` [PATCH] md/raid5: Don't set bi_status on STRIPE_WAIT_RESHAPE Yang Xiuwei

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=e98037c0-de70-4de4-b3ea-e2d67022a7fc@fnnas.com \
    --to=yukuai@fnnas.com \
    --cc=bmarzins@redhat.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=linan666@huaweicloud.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=ncroxon@redhat.com \
    --cc=song@kernel.org \
    --cc=xni@redhat.com \
    --cc=yangxiuwei@kylinos.cn \
    --cc=yukuai@alb-78bjiv52429oh8qptp.cn-shenzhen.alb.aliyuncs.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