From: Keith Busch <kbusch@kernel.org>
To: Hannes Reinecke <hare@suse.de>
Cc: Hannes Reinecke <hare@kernel.org>, Christoph Hellwig <hch@lst.de>,
Sagi Grimberg <sagi@grimberg.me>,
linux-nvme@lists.infradead.org
Subject: Re: [PATCH 2/3] nvme-multipath: cannot disconnect controller on stuck partition scan
Date: Tue, 15 Oct 2024 08:33:19 -0600 [thread overview]
Message-ID: <Zw59LxZ3cngO17_f@kbusch-mbp> (raw)
In-Reply-To: <b7ffdbbb-0b4e-4215-bf2b-b5c2f9a2dc08@suse.de>
On Thu, Oct 10, 2024 at 10:57:23AM +0200, Hannes Reinecke wrote:
> On 10/9/24 19:32, Keith Busch wrote:
> > @@ -974,14 +991,14 @@ void nvme_mpath_shutdown_disk(struct nvme_ns_head *head)
> > return;
> > if (test_and_clear_bit(NVME_NSHEAD_DISK_LIVE, &head->flags)) {
> > nvme_cdev_del(&head->cdev, &head->cdev_device);
> > + /*
> > + * requeue I/O after NVME_NSHEAD_DISK_LIVE has been cleared
> > + * to allow multipath to fail all I/O.
> > + */
> > + synchronize_srcu(&head->srcu);
> > + kblockd_schedule_work(&head->requeue_work);
> > del_gendisk(head->disk);
> > }
>
> I guess we need to split 'test_and_clear_bit()' into a 'test_bit()' when
> testing for the condition and a 'clear_bit()' after del_gendisk().
>
> Otherwise we're having a race condition with nvme_mpath_set_live:
>
> if (!test_and_set_bit(NVME_NSHEAD_DISK_LIVE, &head->flags)) {
> rc = device_add_disk(&head->subsys->dev, head->disk,
> nvme_ns_attr_groups);
>
> which could sneak in from another controller just after we cleared the
> NVME_NSHEAD_DISK_LIVE flag, causing device_add_disk() to fail as the
> same name is already registered.
> Or nvme_cdev_del() to display nice kernel warnings as the cdev was
> not registered.
Is that actually happening for you? I don't think it's supposed to
happen because mpath_shutdwon_disk only happens if the head is detached
from the subsystem, so no other thread should be able to possibly
attempt to access that head's disk for a different controller path. That
new controller should have to allocate an entirely new head.
next prev parent reply other threads:[~2024-10-15 14:34 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-07 10:01 [PATCH 0/3] nvme-multipath: fix deadlock in device_add_disk() Hannes Reinecke
2024-10-07 10:01 ` [PATCH 1/3] nvme-multipath: simplify loop in nvme_update_ana_state() Hannes Reinecke
2024-10-07 15:46 ` Keith Busch
2024-10-08 6:39 ` Christoph Hellwig
2024-10-20 23:33 ` Sagi Grimberg
2024-10-07 10:01 ` [PATCH 2/3] nvme-multipath: cannot disconnect controller on stuck partition scan Hannes Reinecke
2024-10-07 18:19 ` Keith Busch
2024-10-08 6:43 ` Christoph Hellwig
2024-10-08 7:17 ` Hannes Reinecke
2024-10-08 20:41 ` Keith Busch
2024-10-09 6:23 ` Hannes Reinecke
2024-10-09 16:33 ` Keith Busch
2024-10-09 17:10 ` Keith Busch
2024-10-09 17:32 ` Keith Busch
2024-10-10 6:16 ` Hannes Reinecke
2024-10-10 7:18 ` Hannes Reinecke
2024-10-10 8:17 ` Christoph Hellwig
2024-10-10 8:57 ` Hannes Reinecke
2024-10-15 14:33 ` Keith Busch [this message]
2024-10-15 14:56 ` Hannes Reinecke
2024-10-15 15:10 ` Keith Busch
2024-10-20 23:37 ` Sagi Grimberg
2024-10-07 10:01 ` [PATCH 3/3] nvme-multipath: skip failed paths during " Hannes Reinecke
2024-10-08 6:40 ` Christoph Hellwig
2024-10-20 23:38 ` Sagi Grimberg
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=Zw59LxZ3cngO17_f@kbusch-mbp \
--to=kbusch@kernel.org \
--cc=hare@kernel.org \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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