All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: Caleb Sander <csander@purestorage.com>
Cc: Sagi Grimberg <sagi@grimberg.me>, Christoph Hellwig <hch@lst.de>,
	Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@fb.com>,
	linux-nvme@lists.infradead.org,
	Uday Shankar <ushankar@purestorage.com>
Subject: Re: [PATCH] nvme: fix SRCU protection of nvme_ns_head list
Date: Thu, 1 Dec 2022 15:18:04 -0800	[thread overview]
Message-ID: <20221201231804.GL4001@paulmck-ThinkPad-P17-Gen-1> (raw)
In-Reply-To: <CADUfDZpkw3iyiAqJ4X=rypJvLbO7dD2r9yegkYWyXOko-qcpNA@mail.gmail.com>

On Thu, Dec 01, 2022 at 01:27:16PM -0800, Caleb Sander wrote:
> On Tue, Nov 22, 2022 at 7:08 AM Sagi Grimberg <sagi@grimberg.me> wrote:
> > ...
> > The original patch report did not include any sequence that removes all
> > namespaces, and given that it came from RockyLinux 8.6 kernel, it is not
> > 6.1... Hence I think that we need to understand how a namespace removal
> > happened at the same time that the namespace is being scanned. Maybe
> > something else is broken.
> 
> After some more debugging, I found the main cause:
> ns->disk isn't set until after ns is linked into the ns_head list.
> The ns is linked in nvme_init_ns_head(),
> which nvme_alloc_ns() calls before creating the disk:
> static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid,
> struct nvme_ns_ids *ids)
> {
> // ...
> if (nvme_init_ns_head(ns, nsid, ids, id->nmic & NVME_NS_NMIC_SHARED))
> goto out_free_queue;
> 
> disk = alloc_disk_node(0, node);
> if (!disk)
> goto out_unlink_ns;
> // ...
> ns->disk = disk;
> // ...
> }
> 
> It looks like this has never been a problem upstream:
> 5f432cceb3e9 ("nvme: use blk_mq_alloc_disk") fixed the order before
> e7d65803e2bb ("nvme-multipath: revalidate paths during rescan") was committed.
> Strange that the Red Hat 8.6 kernel has pulled in only the later commit.

Sadly, not strange at all.  Keeping upstream sane is hard enough, and
also keeping N -stable releases sane is not any easier.  ;-)

> The list traversal here still needs to be protected by (S)RCU,
> so I would still push for this patch.
> Sagi had suggested using RCU here instead, but discussing with Chris,
> it sounds like we reached a consensus to consistently protect this list
> with SRCU. We can evaluate switching to RCU later if needed,
> but since this is not in the I/O path, I don't see a big performance concern.

For whatever it is worth, makes sense to me!

							Thanx, Paul


  reply	other threads:[~2022-12-01 23:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-18 23:27 [PATCH] nvme: fix SRCU protection of nvme_ns_head list Caleb Sander
2022-11-20 11:24 ` Sagi Grimberg
2022-11-21  7:40   ` Christoph Hellwig
2022-11-21  9:43     ` Sagi Grimberg
2022-11-21 14:57       ` Paul E. McKenney
2022-11-21 17:48     ` Caleb Sander
2022-11-21 17:59       ` Paul E. McKenney
2022-11-21 19:58         ` Caleb Sander
2022-11-22  0:25           ` Paul E. McKenney
2022-11-22 10:06           ` Sagi Grimberg
2022-11-22 12:14             ` Christoph Hellwig
2022-11-22 15:08               ` Sagi Grimberg
2022-11-24  0:12                 ` Caleb Sander
2022-11-24  3:08                   ` Chao Leng
2022-11-24 14:17                   ` Sagi Grimberg
2022-12-01 21:27                 ` Caleb Sander
2022-12-01 23:18                   ` Paul E. McKenney [this message]
2022-11-24  0:24 ` [PATCH] nvme: fix (S)RCU protection of nvme_ns_head list (alternate) Caleb Sander
2022-11-24 14:19   ` Sagi Grimberg
2022-11-29  8:39   ` Christoph Hellwig
2022-11-30  8:25     ` Sagi Grimberg
2022-11-30  8:35       ` Christoph Hellwig
2022-11-30  8:40         ` Sagi Grimberg
2022-12-01 21:17           ` Caleb Sander
2022-12-02  1:21             ` Chao Leng

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=20221201231804.GL4001@paulmck-ThinkPad-P17-Gen-1 \
    --to=paulmck@kernel.org \
    --cc=axboe@fb.com \
    --cc=csander@purestorage.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=ushankar@purestorage.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 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.