[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b06cafde-a6e0-6d52-8113-7ec3895f3b30@huaweicloud.com>
Date: Wed, 28 Jun 2023 17:28:22 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: linan666@...weicloud.com, song@...nel.org,
guoqing.jiang@...ud.ionos.com, colyli@...e.de, xni@...hat.com
Cc: linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org,
linan122@...wei.com, yi.zhang@...wei.com, houtao1@...wei.com,
yangerkun@...wei.com, "yukuai (C)" <yukuai3@...wei.com>
Subject: Re: [PATCH 3/3] md/raid10: use get_rdev_repl_from_mirror() to get
devices
在 2023/06/28 9:57, linan666@...weicloud.com 写道:
> From: Li Nan <linan122@...wei.com>
>
> Commit 2ae6aaf76912 ("md/raid10: fix io loss while replacement replace
> rdev") reads replacement first to prevent io loss. However, there are same
> issue in wait_blocked_dev() and raid10_handle_discard(), too. Fix it by
> using get_rdev_repl_from_mirror() to get devices.
LGTM
Reviewed-by: Yu Kuai <yukuai3@...wei.com>
>
> Fixes: d30588b2731f ("md/raid10: improve raid10 discard request")
> Fixes: f2e7e269a752 ("md/raid10: pull the code that wait for blocked dev into one function")
> Signed-off-by: Li Nan <linan122@...wei.com>
> ---
> drivers/md/raid10.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index eaaf6307ddda..2d55374d8b22 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -1376,11 +1376,9 @@ static void wait_blocked_dev(struct mddev *mddev, struct r10bio *r10_bio)
> blocked_rdev = NULL;
> rcu_read_lock();
> for (i = 0; i < conf->copies; i++) {
> - struct md_rdev *rdev = rcu_dereference(conf->mirrors[i].rdev);
> - struct md_rdev *rrdev = rcu_dereference(
> - conf->mirrors[i].replacement);
> - if (rdev == rrdev)
> - rrdev = NULL;
> + struct md_rdev *rdev, *rrdev;
> +
> + get_rdev_repl_from_mirror(&conf->mirrors[i], &rdev, &rrdev);
> if (rdev && unlikely(test_bit(Blocked, &rdev->flags))) {
> atomic_inc(&rdev->nr_pending);
> blocked_rdev = rdev;
> @@ -1816,15 +1814,12 @@ static int raid10_handle_discard(struct mddev *mddev, struct bio *bio)
> */
> rcu_read_lock();
> for (disk = 0; disk < geo->raid_disks; disk++) {
> - struct md_rdev *rdev = rcu_dereference(conf->mirrors[disk].rdev);
> - struct md_rdev *rrdev = rcu_dereference(
> - conf->mirrors[disk].replacement);
> + struct md_rdev *rdev, *rrdev;
>
> + get_rdev_repl_from_mirror(&conf->mirrors[disk], &rdev, &rrdev);
> r10_bio->devs[disk].bio = NULL;
> r10_bio->devs[disk].repl_bio = NULL;
>
> - if (rdev == rrdev)
> - rrdev = NULL;
> if (rdev && (test_bit(Faulty, &rdev->flags)))
> rdev = NULL;
> if (rrdev && (test_bit(Faulty, &rrdev->flags)))
>
Powered by blists - more mailing lists