From: Guoqing Jiang <guoqing.jiang@linux.dev>
To: Christoph Hellwig <hch@lst.de>, Song Liu <song@kernel.org>
Cc: Logan Gunthorpe <logang@deltatee.com>,
linux-raid@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: [PATCH 8/9] md: only delete entries from all_mddevs when the disk is freed
Date: Fri, 15 Jul 2022 17:03:53 +0800 [thread overview]
Message-ID: <0117b8d7-b318-df06-4ada-2d4eaefea68a@linux.dev> (raw)
In-Reply-To: <20220713113125.2232975-9-hch@lst.de>
On 7/13/22 7:31 PM, Christoph Hellwig wrote:
> This ensures device names don't get prematurely reused.*Instead* add a
> deleted flag to skip already deleted devices in mddev_get and other
> places that only want to see live mddevs.
The patch actually adds a deleted member to struct mddev , so the
"Instead" here
is at least confusing to me.
> Reported-by; Logan Gunthorpe<logang@deltatee.com>
> Signed-off-by: Christoph Hellwig<hch@lst.de>
> ---
> drivers/md/md.c | 56 +++++++++++++++++++++++++++++++++----------------
> drivers/md/md.h | 1 +
> 2 files changed, 39 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index df99a16892bce..f3ff61e540ee0 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -625,6 +625,10 @@ EXPORT_SYMBOL(md_flush_request);
>
> static inline struct mddev *mddev_get(struct mddev *mddev)
> {
> + lockdep_assert_held(&all_mddevs_lock);
> +
> + if (mddev->deleted)
> + return NULL;
> atomic_inc(&mddev->active);
...
> diff --git a/drivers/md/md.h b/drivers/md/md.h
> index 1a85dbe78a71c..bc870e1f1e8c2 100644
> --- a/drivers/md/md.h
> +++ b/drivers/md/md.h
> @@ -503,6 +503,7 @@ struct mddev {
>
> atomic_t max_corr_read_errors; /* max read retries */
> struct list_head all_mddevs;
> + bool deleted;
>
> const struct attribute_group *to_remove;
Thanks,
Guoqing
next prev parent reply other threads:[~2022-07-15 9:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-13 11:31 fix md disk_name lifetime problems v2 Christoph Hellwig
2022-07-13 11:31 ` [PATCH 1/9] md: fix error handling in md_alloc Christoph Hellwig
2022-07-13 15:26 ` Logan Gunthorpe
2022-07-13 16:31 ` Logan Gunthorpe
2022-07-13 11:31 ` [PATCH 2/9] md: implement ->free_disk Christoph Hellwig
2022-07-13 11:31 ` [PATCH 3/9] md: rename md_free to md_kobj_release Christoph Hellwig
2022-07-15 9:00 ` Guoqing Jiang
2022-07-13 11:31 ` [PATCH 4/9] md: factor out the rdev overlaps check from rdev_size_store Christoph Hellwig
2022-07-15 9:01 ` Guoqing Jiang
2022-07-13 11:31 ` [PATCH 5/9] md: stop using for_each_mddev in md_do_sync Christoph Hellwig
2022-07-13 11:31 ` [PATCH 6/9] md: stop using for_each_mddev in md_notify_reboot Christoph Hellwig
2022-07-15 9:02 ` Guoqing Jiang
2022-07-13 11:31 ` [PATCH 7/9] md: stop using for_each_mddev in md_exit Christoph Hellwig
2022-07-13 11:31 ` [PATCH 8/9] md: only delete entries from all_mddevs when the disk is freed Christoph Hellwig
2022-07-15 9:03 ` Guoqing Jiang [this message]
2022-07-13 11:31 ` [PATCH 9/9] md: simplify md_open Christoph Hellwig
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=0117b8d7-b318-df06-4ada-2d4eaefea68a@linux.dev \
--to=guoqing.jiang@linux.dev \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=logang@deltatee.com \
--cc=song@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.