From: Xiao Ni <xni@redhat.com>
To: Yu Kuai <yukuai1@huaweicloud.com>
Cc: agk@redhat.com, snitzer@kernel.org, dm-devel@redhat.com,
song@kernel.org, linux-kernel@vger.kernel.org,
linux-raid@vger.kernel.org, yukuai3@huawei.com,
yi.zhang@huawei.com, yangerkun@huawei.com
Subject: Re: [PATCH -next v2 02/28] md: use 'mddev->suspended' for is_md_suspended()
Date: Wed, 20 Sep 2023 16:46:42 +0800 [thread overview]
Message-ID: <CALTww29iHX_GHogGFEfzdaDjohBr8ycfiz2=E_ru4JYvmrTYdA@mail.gmail.com> (raw)
In-Reply-To: <20230828020021.2489641-3-yukuai1@huaweicloud.com>
On Mon, Aug 28, 2023 at 10:04 AM Yu Kuai <yukuai1@huaweicloud.com> wrote:
>
> From: Yu Kuai <yukuai3@huawei.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@huawei.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
>
next prev parent reply other threads:[~2023-09-20 8:47 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-28 1:59 [PATCH -next v2 00/28] md: synchronize io with array reconfiguration Yu Kuai
2023-08-28 1:59 ` [PATCH -next v2 01/28] md: use READ_ONCE/WRITE_ONCE for 'suspend_lo' and 'suspend_hi' Yu Kuai
2023-09-14 2:53 ` Xiao Ni
2023-09-25 1:18 ` Yu Kuai
2023-08-28 1:59 ` [PATCH -next v2 02/28] md: use 'mddev->suspended' for is_md_suspended() Yu Kuai
2023-09-20 8:46 ` Xiao Ni [this message]
2023-09-25 1:34 ` Yu Kuai
2023-08-28 1:59 ` [PATCH -next v2 03/28] md: add new helpers to suspend/resume array Yu Kuai
2023-09-25 7:21 ` Xiao Ni
2023-09-25 7:23 ` Xiao Ni
2023-08-28 1:59 ` [PATCH -next v2 04/28] md: add new helpers to suspend/resume and lock/unlock array Yu Kuai
2023-08-28 1:59 ` [PATCH -next v2 05/28] md: use new apis to suspend array for suspend_lo/hi_store() Yu Kuai
2023-08-28 1:59 ` [PATCH -next v2 06/28] md: use new apis to suspend array for level_store() Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 07/28] md: use new apis to suspend array for serialize_policy_store() Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 08/28] md/dm-raid: use new apis to suspend array Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 09/28] md/md-bitmap: use new apis to suspend array for location_store() Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 10/28] md/raid5-cache: use READ_ONCE/WRITE_ONCE for 'conf->log' Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 11/28] md/raid5-cache: use new apis to suspend array for r5c_disable_writeback_async() Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 12/28] md/raid5-cache: use new apis to suspend array for r5c_journal_mode_store() Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 13/28] md/raid5: use new apis to suspend array for raid5_store_stripe_size() Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 14/28] md/raid5: use new apis to suspend array for raid5_store_skip_copy() Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 15/28] md/raid5: use new apis to suspend array for raid5_store_group_thread_cnt() Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 16/28] md/raid5: use new apis to suspend array for raid5_change_consistency_policy() Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 17/28] md/raid5: replace suspend with quiesce() callback Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 18/28] md: quiesce before md_kick_rdev_from_array() for md-cluster Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 19/28] md: use new apis to suspend array for ioctls involed array reconfiguration Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 20/28] md: use new apis to suspend array for adding/removing rdev from state_store() Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 21/28] md: use new apis to suspend array for bind_rdev_to_array() Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 22/28] md: use new apis to suspend array related to serial pool in state_store() Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 23/28] md: use new apis to suspend array in backlog_store() Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 24/28] md: suspend array in md_start_sync() if array need reconfiguration Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 25/28] md: cleanup mddev_create/destroy_serial_pool() Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 26/28] md/md-linear: cleanup linear_add() Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 27/28] md: remove old apis to suspend the array Yu Kuai
2023-08-28 2:00 ` [PATCH -next v2 28/28] md: rename __mddev_suspend/resume() back to mddev_suspend/resume() Yu Kuai
2023-09-25 15:45 ` [PATCH -next v2 00/28] md: synchronize io with array reconfiguration Song Liu
2023-09-26 0:55 ` 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='CALTww29iHX_GHogGFEfzdaDjohBr8ycfiz2=E_ru4JYvmrTYdA@mail.gmail.com' \
--to=xni@redhat.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=snitzer@kernel.org \
--cc=song@kernel.org \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yukuai1@huaweicloud.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).