Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH 2/2] nvme-multipath: do not select namespaces which are about to be removed
Date: Wed, 3 Jul 2019 15:21:33 +0200	[thread overview]
Message-ID: <20190703132133.GA8948@lst.de> (raw)
In-Reply-To: <20190703131232.58595-3-hare@suse.de>

On Wed, Jul 03, 2019@03:12:32PM +0200, Hannes Reinecke wrote:
> diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
> index c8cc82639327..1f6105a5c596 100644
> --- a/drivers/nvme/host/multipath.c
> +++ b/drivers/nvme/host/multipath.c
> @@ -130,7 +130,8 @@ static struct nvme_ns *__nvme_find_path(struct nvme_ns_head *head, int node)
>  
>  	list_for_each_entry_rcu(ns, &head->list, siblings) {
>  		if (ns->ctrl->state != NVME_CTRL_LIVE ||
> -		    test_bit(NVME_NS_ANA_PENDING, &ns->flags))
> +		    test_bit(NVME_NS_ANA_PENDING, &ns->flags) ||
> +		    test_bit(NVME_NS_REMOVING, &ns->flags))
>  			continue;
>  
>  		if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_NUMA)
> @@ -180,7 +181,8 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head,
>  
>  	if (list_is_singular(&head->list)) {
>  		if (old->ctrl->state != NVME_CTRL_LIVE ||
> -		    test_bit(NVME_NS_ANA_PENDING, &old->flags))
> +		    test_bit(NVME_NS_ANA_PENDING, &old->flags)||
> +		    test_bit(NVME_NS_REMOVING, &old->flags))
>  			return NULL;
>  		return old;
>  	}
> @@ -189,7 +191,8 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head,
>  	     ns != old;
>  	     ns = nvme_next_ns(head, ns)) {
>  		if (ns->ctrl->state != NVME_CTRL_LIVE ||
> -		    test_bit(NVME_NS_ANA_PENDING, &ns->flags))
> +		    test_bit(NVME_NS_ANA_PENDING, &ns->flags) ||
> +		    test_bit(NVME_NS_REMOVING, &ns->flags))
>  			continue;

I think we clearly need a patch before the two patches in your
series that factors this check into a little helper with a
descriptive name.  Also doesn't nvme_path_is_optimized also need
to have these checks while we are at it?

  reply	other threads:[~2019-07-03 13:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-03 13:12 [PATCH 0/2] nvme-multipath: path selection fixes Hannes Reinecke
2019-07-03 13:12 ` [PATCH 1/2] nvme-multipath: check singular list in vme_round_robin_path() Hannes Reinecke
2019-07-03 13:12 ` [PATCH 2/2] nvme-multipath: do not select namespaces which are about to be removed Hannes Reinecke
2019-07-03 13:21   ` Christoph Hellwig [this message]
2019-07-03 20:33     ` Sagi Grimberg
2019-07-04  6:00       ` Hannes Reinecke
  -- strict thread matches above, loose matches on Subject: below --
2019-07-04  6:10 [PATCHv2 0/2] nvme-multipath: path selection fixes Hannes Reinecke
2019-07-04  6:10 ` [PATCH 2/2] nvme-multipath: do not select namespaces which are about to be removed 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=20190703132133.GA8948@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox