linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yu Kuai <yukuai1@huaweicloud.com>
To: Xueshi Hu <xueshi.hu@smartx.com>,
	song@kernel.org, djeffery@redhat.com, dan.j.williams@intel.com,
	neilb@suse.de, akpm@linux-foundation.org, neilb@suse.com
Cc: linux-raid@vger.kernel.org, "yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH v5 2/3] md/raid1: free the r1bio firstly before waiting for blocked rdev
Date: Mon, 14 Aug 2023 20:37:08 +0800	[thread overview]
Message-ID: <2ee5d414-90e7-8b3d-71d4-5074936e0413@huaweicloud.com> (raw)
In-Reply-To: <20230814085108.991040-3-xueshi.hu@smartx.com>

在 2023/08/14 16:51, Xueshi Hu 写道:
> Raid1 reshape will change mempool and r1conf::raid_disks which are
> necessary when freeing r1bio. allow_barrier() make an concurrent
> raid1_reshape() possible. So, free the in-flight r1bio firstly before
> waiting blocked rdev.
> 
> Fixes: 6bfe0b499082 ("md: support blocking writes to an array on device failure")

LGTM

Reviewed-by: Yu Kuai <yukuai3@huawei.com>

> Signed-off-by: Xueshi Hu <xueshi.hu@smartx.com>
> ---
>   drivers/md/raid1.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index dbbee0c14a5b..5f17f30a00a9 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -1374,6 +1374,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
>   		return;
>   	}
>   
> + retry_write:
>   	r1_bio = alloc_r1bio(mddev, bio);
>   	r1_bio->sectors = max_write_sectors;
>   
> @@ -1389,7 +1390,6 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
>   	 */
>   
>   	disks = conf->raid_disks * 2;
> - retry_write:
>   	blocked_rdev = NULL;
>   	rcu_read_lock();
>   	max_sectors = r1_bio->sectors;
> @@ -1469,7 +1469,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
>   		for (j = 0; j < i; j++)
>   			if (r1_bio->bios[j])
>   				rdev_dec_pending(conf->mirrors[j].rdev, mddev);
> -		r1_bio->state = 0;
> +		free_r1bio(r1_bio);
>   		allow_barrier(conf, bio->bi_iter.bi_sector);
>   
>   		if (bio->bi_opf & REQ_NOWAIT) {
> 


  reply	other threads:[~2023-08-14 12:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-14  8:51 [PATCH v5 0/3] md/raid1: don't allow_barrier() before r1bio got freed Xueshi Hu
2023-08-14  8:51 ` [PATCH v5 1/3] md/raid1: call free_r1bio() before allow_barrier() Xueshi Hu
2023-08-14 12:35   ` Yu Kuai
2023-08-14  8:51 ` [PATCH v5 2/3] md/raid1: free the r1bio firstly before waiting for blocked rdev Xueshi Hu
2023-08-14 12:37   ` Yu Kuai [this message]
2023-08-14  8:51 ` [PATCH v5 3/3] md/raid1: keep the barrier held until handle_read_error() finished Xueshi Hu
2023-08-14 12:38   ` Yu Kuai

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=2ee5d414-90e7-8b3d-71d4-5074936e0413@huaweicloud.com \
    --to=yukuai1@huaweicloud.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=djeffery@redhat.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.com \
    --cc=neilb@suse.de \
    --cc=song@kernel.org \
    --cc=xueshi.hu@smartx.com \
    --cc=yukuai3@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;
as well as URLs for NNTP newsgroup(s).