All of lore.kernel.org
 help / color / mirror / Atom feed
From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH 2/3] nvme: shorten race window in nvme_ns_remove()
Date: Wed, 27 Mar 2019 15:02:51 +0100	[thread overview]
Message-ID: <20190327140251.GA25990@lst.de> (raw)
In-Reply-To: <20190327080929.27918-3-hare@suse.de>

On Wed, Mar 27, 2019@09:09:28AM +0100, Hannes Reinecke wrote:
> nvme_ns_remove() sets the 'NVME_NS_REMOVING' bit at first, but
> only removes the namespace from the list at the very end.
> This opens a rether large race window during which other processes
> traversing the namespaces via list_for_each() will access partially
> deleted namespaces, causing unpredictable results.
> This patch shortens the race window by removing the namespace
> from the list as early as possible.
> 
> Signed-off-by: Hannes Reinecke <hare at suse.com>

With this patch I don't see any reason for your patch 1, given that
the window between setting the REMOVING bit and removing from the
list is so tiny.

That being said I think we really should also remove the namespace
from ->siblings and clear the current path ASAP as well, which might
remove the need for patch 3 as well.

  reply	other threads:[~2019-03-27 14:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-27  8:09 [PATCH 0/3] nvme: fixup race with namespace removal Hannes Reinecke
2019-03-27  8:09 ` [PATCH 1/3] nvme: do not quiesce or unquiesce invalid namespaces Hannes Reinecke
2019-03-27  8:09 ` [PATCH 2/3] nvme: shorten race window in nvme_ns_remove() Hannes Reinecke
2019-03-27 14:02   ` Christoph Hellwig [this message]
2019-03-27 14:41     ` Hannes Reinecke
2019-03-27 14:20   ` Keith Busch
2019-03-27 15:12     ` Hannes Reinecke
2019-03-27 18:50       ` James Smart
2019-03-28  9:27         ` Hannes Reinecke
2019-03-28 11:07           ` Ming Lei
2019-03-28 11:48             ` Hannes Reinecke
2019-03-28 12:11               ` Hannes Reinecke
2019-03-28 15:19                 ` Ming Lei
2019-03-28 15:56                   ` James Smart
2019-03-28 15:46                 ` James Smart
2019-03-28 15:57                   ` Hannes Reinecke
2019-03-28 17:50                     ` James Smart
2019-03-28 15:05           ` James Smart
2019-03-28 15:50             ` Hannes Reinecke
2019-03-29  0:40               ` Ming Lei
2019-03-27  8:09 ` [PATCH 3/3] nvme-multipath: test namespace state when selecting a new path 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=20190327140251.GA25990@lst.de \
    --to=hch@lst.de \
    /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.