Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Hannes Reinecke <hare@suse.de>
Cc: Sagi Grimberg <sagi@grimberg.me>,
	linux-nvme@lists.infradead.org, Christoph Hellwig <hch@lst.de>,
	Keith Busch <kbusch@kernel.org>,
	Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>,
	Yogev Cohen <yogev@lightbitslabs.com>
Subject: Re: [PATCH] nvme-multipath: fix possible hang in live ns resize with ANA access
Date: Fri, 30 Sep 2022 08:40:03 +0200	[thread overview]
Message-ID: <20220930064003.GA23345@lst.de> (raw)
In-Reply-To: <04bf1cdd-3093-99c8-3aff-32ed3278c805@suse.de>

On Fri, Sep 30, 2022 at 08:29:54AM +0200, Hannes Reinecke wrote:
>>   void nvme_mpath_revalidate_paths(struct nvme_ns *ns)
>>   {
>>   	struct nvme_ns_head *head = ns->head;
>> +	struct nvme_ns *n;
>>   	sector_t capacity = get_capacity(head->disk);
>>   	int node;
>>   -	list_for_each_entry_rcu(ns, &head->list, siblings) {
>> -		if (capacity != get_capacity(ns->disk))
>> -			clear_bit(NVME_NS_READY, &ns->flags);
>> +	list_for_each_entry_rcu(n, &head->list, siblings) {
>> +		if (capacity != get_capacity(n->disk))
>> +			clear_bit(NVME_NS_READY, &n->flags);
>>   	}
>>     	for_each_node(node)
>>   		rcu_assign_pointer(head->current_path[node], NULL);
>> +	nvme_kick_requeue_lists(ns->ctrl);
>>   }
>>     static bool nvme_path_is_disabled(struct nvme_ns *ns)
>
> Hmm. I guess the real issue is that we use 'ns' as both function argument 
> _and_ iterator, so that after 'list_for_each_rcu()' 'ns' is pointing to a 
> _different_ namespace, such that we end up kicking that namespace and not 
> the one used as argument.
> But in either case, patch is fine.

BEfore this patch that wasn't an actual problem as the ns pass as
argument was only used to derived the ns_head but not used after
the loop.  It was a bit of a landmine, though.


      reply	other threads:[~2022-09-30  6:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 13:58 [PATCH] nvme-multipath: fix possible hang in live ns resize with ANA access Sagi Grimberg
2022-09-28 17:02 ` Daniel Wagner
2022-09-28 17:14 ` Christoph Hellwig
2022-09-28 20:07   ` Sagi Grimberg
2022-09-28 17:21 ` Keith Busch
2022-09-28 20:06   ` Sagi Grimberg
2022-09-30  6:29 ` Hannes Reinecke
2022-09-30  6:40   ` Christoph Hellwig [this message]

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=20220930064003.GA23345@lst.de \
    --to=hch@lst.de \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=hare@suse.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=yogev@lightbitslabs.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox