From: Christoph Hellwig <hch@lst.de>
To: Hannes Reinecke <hare@suse.de>
Cc: Christoph Hellwig <hch@lst.de>, Song Liu <song@kernel.org>,
Logan Gunthorpe <logang@deltatee.com>,
linux-raid@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: [PATCH 09/10] md: only delete entries from all_mddevs when the disk is freed
Date: Tue, 19 Jul 2022 09:14:34 +0200 [thread overview]
Message-ID: <20220719071434.GA28668@lst.de> (raw)
In-Reply-To: <b8521a53-fb41-279c-dc43-580e8d0de045@suse.de>
On Mon, Jul 18, 2022 at 09:17:42AM +0200, Hannes Reinecke wrote:
> Why can't we use 'atomic_inc_unless_zero' here and do away with the
> additional 'deleted' flag?
See my previous reply.
>> @@ -3338,6 +3342,8 @@ static bool md_rdev_overlaps(struct md_rdev *rdev)
>> spin_lock(&all_mddevs_lock);
>> list_for_each_entry(mddev, &all_mddevs, all_mddevs) {
>> + if (mddev->deleted)
>> + continue;
>
> Any particular reason why you can't use the 'mddev_get()' / 'mddev_put()'
> sequence here?
Mostly because it would be pretty mess. mdev_put takes all_mddevs_lock,
so we'd have to add an unlock/relock cycle for each loop iteration.
> After all, I don't think that 'mddev' should vanish while being in this
> loop, no?
It won't, at least without the call to mddev_put. Once mddev_put is
in the game things aren't that easy, and I suspect the exising and
new code might have bugs in that area in the reboot notifier and
md_exit for extreme corner cases.
next prev parent reply other threads:[~2022-07-19 7:14 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-18 6:34 fix md disk_name lifetime problems v3 Christoph Hellwig
2022-07-18 6:34 ` [PATCH 01/10] md: fix mddev->kobj lifetime Christoph Hellwig
2022-07-18 6:55 ` Hannes Reinecke
2022-07-18 19:48 ` Logan Gunthorpe
2022-07-18 6:34 ` [PATCH 02/10] md: fix error handling in md_alloc Christoph Hellwig
2022-07-18 7:00 ` Hannes Reinecke
2022-07-18 19:48 ` Logan Gunthorpe
2022-07-18 6:34 ` [PATCH 03/10] md: implement ->free_disk Christoph Hellwig
2022-07-18 7:01 ` Hannes Reinecke
2022-07-18 20:01 ` Logan Gunthorpe
2022-07-18 6:34 ` [PATCH 04/10] md: rename md_free to md_kobj_release Christoph Hellwig
2022-07-18 7:01 ` Hannes Reinecke
2022-07-18 20:02 ` Logan Gunthorpe
2022-07-18 6:34 ` [PATCH 05/10] md: factor out the rdev overlaps check from rdev_size_store Christoph Hellwig
2022-07-18 7:02 ` Hannes Reinecke
2022-07-18 20:02 ` Logan Gunthorpe
2022-07-18 6:34 ` [PATCH 06/10] md: stop using for_each_mddev in md_do_sync Christoph Hellwig
2022-07-18 7:03 ` Hannes Reinecke
2022-07-18 20:02 ` Logan Gunthorpe
2022-07-18 6:34 ` [PATCH 07/10] md: stop using for_each_mddev in md_notify_reboot Christoph Hellwig
2022-07-18 7:05 ` Hannes Reinecke
2022-07-18 20:03 ` Logan Gunthorpe
2022-07-18 6:34 ` [PATCH 08/10] md: stop using for_each_mddev in md_exit Christoph Hellwig
2022-07-18 7:10 ` Hannes Reinecke
2022-07-19 7:03 ` Christoph Hellwig
2022-07-19 7:06 ` Hannes Reinecke
2022-07-18 20:03 ` Logan Gunthorpe
2022-07-18 6:34 ` [PATCH 09/10] md: only delete entries from all_mddevs when the disk is freed Christoph Hellwig
2022-07-18 7:17 ` Hannes Reinecke
2022-07-18 18:20 ` Song Liu
2022-07-19 5:06 ` Christoph Hellwig
2022-07-19 6:28 ` Song Liu
2022-07-19 7:00 ` Hannes Reinecke
2022-07-19 7:14 ` Christoph Hellwig [this message]
2022-07-19 7:59 ` Hannes Reinecke
2022-07-18 6:34 ` [PATCH 10/10] md: simplify md_open Christoph Hellwig
2022-07-18 7:19 ` Hannes Reinecke
-- strict thread matches above, loose matches on Subject: below --
2022-07-19 9:18 fix md disk_name lifetime problems v4 Christoph Hellwig
2022-07-19 9:18 ` [PATCH 09/10] md: only delete entries from all_mddevs when the disk is freed Christoph Hellwig
2022-07-19 9:25 ` Hannes Reinecke
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=20220719071434.GA28668@lst.de \
--to=hch@lst.de \
--cc=hare@suse.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 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).