From: Song Liu <song@kernel.org>
To: Yu Kuai <yukuai1@huaweicloud.com>
Cc: xni@redhat.com, agk@redhat.com, snitzer@kernel.org,
dm-devel@redhat.com, linux-kernel@vger.kernel.org,
linux-raid@vger.kernel.org, yukuai3@huawei.com,
yi.zhang@huawei.com, yangerkun@huawei.com
Subject: Re: [PATCH -next v3 03/25] md: add new helpers to suspend/resume array
Date: Thu, 28 Sep 2023 11:45:48 -0700 [thread overview]
Message-ID: <CAPhsuW4tQ9A+ddpxGhfza3WSdkL+FXmS-4NLUUN7MNk0TOY0WA@mail.gmail.com> (raw)
In-Reply-To: <20230928061543.1845742-4-yukuai1@huaweicloud.com>
On Wed, Sep 27, 2023 at 11:22 PM Yu Kuai <yukuai1@huaweicloud.com> wrote:
>
> From: Yu Kuai <yukuai3@huawei.com>
>
> Advantages for new apis:
> - reconfig_mutex is not required;
> - the weird logical that suspend array hold 'reconfig_mutex' for
> mddev_check_recovery() to update superblock is not needed;
> - the specail handling, 'pers->prepare_suspend', for raid456 is not
> needed;
> - It's safe to be called at any time once mddev is allocated, and it's
> designed to be used from slow path where array configuration is changed;
> - the new helpers is designed to be called before mddev_lock(), hence
> it support to be interrupted by user as well.
>
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> ---
> drivers/md/md.c | 102 +++++++++++++++++++++++++++++++++++++++++++++++-
> drivers/md/md.h | 3 ++
> 2 files changed, 103 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index e460b380143d..a075d03d03d3 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -443,12 +443,22 @@ void mddev_suspend(struct mddev *mddev)
> lockdep_is_held(&mddev->reconfig_mutex));
>
> WARN_ON_ONCE(thread && current == thread->tsk);
> - if (mddev->suspended++)
> +
> + /* can't concurrent with __mddev_suspend() and __mddev_resume() */
> + mutex_lock(&mddev->suspend_mutex);
> + if (mddev->suspended++) {
> + mutex_unlock(&mddev->suspend_mutex);
> return;
Can we make mddev->suspended atomic_t, and use atomic_inc_return()
here?
Thanks,
Song
[...]
next prev parent reply other threads:[~2023-09-28 18:46 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-28 6:15 [PATCH -next v3 00/25] md: synchronize io with array reconfiguration Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 01/25] md: use READ_ONCE/WRITE_ONCE for 'suspend_lo' and 'suspend_hi' Yu Kuai
2023-09-28 15:54 ` Song Liu
2023-09-28 6:15 ` [PATCH -next v3 02/25] md: replace is_md_suspended() with 'mddev->suspended' in md_check_recovery() Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 03/25] md: add new helpers to suspend/resume array Yu Kuai
2023-09-28 18:45 ` Song Liu [this message]
[not found] ` <0ae441ba-68db-b823-b48c-76e953d22067@huaweicloud.com>
2023-10-05 4:00 ` Song Liu
2023-09-28 6:15 ` [PATCH -next v3 04/25] md: add new helpers to suspend/resume and lock/unlock array Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 05/25] md: use new apis to suspend array for suspend_lo/hi_store() Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 06/25] md: use new apis to suspend array for level_store() Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 07/25] md: use new apis to suspend array for serialize_policy_store() Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 08/25] md/dm-raid: use new apis to suspend array Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 09/25] md/md-bitmap: use new apis to suspend array for location_store() Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 10/25] md/raid5-cache: use READ_ONCE/WRITE_ONCE for 'conf->log' Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 11/25] md/raid5-cache: use new apis to suspend array for r5c_disable_writeback_async() Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 12/25] md/raid5-cache: use new apis to suspend array for r5c_journal_mode_store() Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 13/25] md/raid5: use new apis to suspend array for raid5_store_stripe_size() Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 14/25] md/raid5: use new apis to suspend array for raid5_store_skip_copy() Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 15/25] md/raid5: use new apis to suspend array for raid5_store_group_thread_cnt() Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 16/25] md/raid5: use new apis to suspend array for raid5_change_consistency_policy() Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 17/25] md/raid5: replace suspend with quiesce() callback Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 18/25] md: use new apis to suspend array for ioctls involed array reconfiguration Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 19/25] md: use new apis to suspend array for adding/removing rdev from state_store() Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 20/25] md: use new apis to suspend array before mddev_create/destroy_serial_pool Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 21/25] md: cleanup mddev_create/destroy_serial_pool() Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 22/25] md/md-linear: cleanup linear_add() Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 23/25] md: suspend array in md_start_sync() if array need reconfiguration Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 24/25] md: remove old apis to suspend the array Yu Kuai
2023-09-28 6:15 ` [PATCH -next v3 25/25] md: rename __mddev_suspend/resume() back to mddev_suspend/resume() Yu Kuai
2023-09-28 19:15 ` [PATCH -next v3 00/25] md: synchronize io with array reconfiguration Song Liu
[not found] ` <f59cbb99-33dd-c427-2e43-5a07ab9fbf51@huaweicloud.com>
2023-10-05 3:55 ` Song Liu
2023-10-07 2:32 ` Yu Kuai
2023-10-07 2:40 ` Song Liu
2023-10-07 2:49 ` 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=CAPhsuW4tQ9A+ddpxGhfza3WSdkL+FXmS-4NLUUN7MNk0TOY0WA@mail.gmail.com \
--to=song@kernel.org \
--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=xni@redhat.com \
--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).