[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALTww29iHX_GHogGFEfzdaDjohBr8ycfiz2=E_ru4JYvmrTYdA@mail.gmail.com>
Date: Wed, 20 Sep 2023 16:46:42 +0800
From: Xiao Ni <xni@...hat.com>
To: Yu Kuai <yukuai1@...weicloud.com>
Cc: agk@...hat.com, snitzer@...nel.org, dm-devel@...hat.com,
song@...nel.org, linux-kernel@...r.kernel.org,
linux-raid@...r.kernel.org, yukuai3@...wei.com,
yi.zhang@...wei.com, yangerkun@...wei.com
Subject: Re: [PATCH -next v2 02/28] md: use 'mddev->suspended' for is_md_suspended()
On Mon, Aug 28, 2023 at 10:04 AM Yu Kuai <yukuai1@...weicloud.com> wrote:
>
> From: Yu Kuai <yukuai3@...wei.com>
>
> 'pers->prepare_suspend' is introduced to prevent a deadlock for raid456,
> this change prepares to clean this up in later patches while refactoring
> mddev_suspend(). Specifically allow reshape to make progress while
> waiting for 'active_io' to be 0.
Hi Kuai
>From my side, I can't understand the comments. The change has
relationship with pers->prepare_suspend? And why this change can
affect reshape? If this change indeed can affect these two things, can
you explain more?
>
> Signed-off-by: Yu Kuai <yukuai3@...wei.com>
> ---
> drivers/md/md.c | 2 +-
> drivers/md/md.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 9d8dff9d923c..7fa311a14317 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -355,7 +355,7 @@ static DEFINE_SPINLOCK(all_mddevs_lock);
> */
> static bool is_suspended(struct mddev *mddev, struct bio *bio)
> {
> - if (is_md_suspended(mddev))
> + if (is_md_suspended(mddev) || percpu_ref_is_dying(&mddev->active_io))
If we use mddev->suspended to judge if the raid is suspended, it
should be enough? Because mddev->suspended must be true when active_io
is dying.
Best Regards
Xiao
> return true;
> if (bio_data_dir(bio) != WRITE)
> return false;
> diff --git a/drivers/md/md.h b/drivers/md/md.h
> index b628c292506e..fb3b123f16dd 100644
> --- a/drivers/md/md.h
> +++ b/drivers/md/md.h
> @@ -584,7 +584,7 @@ static inline bool md_is_rdwr(struct mddev *mddev)
>
> static inline bool is_md_suspended(struct mddev *mddev)
> {
> - return percpu_ref_is_dying(&mddev->active_io);
> + return READ_ONCE(mddev->suspended);
> }
>
> static inline int __must_check mddev_lock(struct mddev *mddev)
> --
> 2.39.2
>
Powered by blists - more mailing lists