From: Chao Leng <lengchao@huawei.com>
To: Hannes Reinecke <hare@suse.de>, Sagi Grimberg <sagi@grimberg.me>,
"Daniel Wagner" <dwagner@suse.de>
Cc: <linux-nvme@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
"Jens Axboe" <axboe@fb.com>, Keith Busch <kbusch@kernel.org>,
Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v2] nvme-multipath: Early exit if no path is available
Date: Tue, 2 Feb 2021 09:12:30 +0800 [thread overview]
Message-ID: <6ef6df55-318b-887d-b14f-62cae6419b4a@huawei.com> (raw)
In-Reply-To: <2752ed93-6bd5-1a13-0e05-b91e2dcc24e1@suse.de>
On 2021/2/1 18:45, Hannes Reinecke wrote:
> On 2/1/21 10:40 AM, Chao Leng wrote:
>>
>>
>> On 2021/2/1 16:57, Hannes Reinecke wrote:
>>> On 2/1/21 9:47 AM, Chao Leng wrote:
>>>>
>>>>
>>>> On 2021/2/1 15:29, Hannes Reinecke wrote:[ .. ]
>>>>> Urgh. Please, no. That is well impossible to debug.
>>>>> Can you please open-code it to demonstrate where the difference to the current (and my fixed) versions is?
>>>>> I'm still not clear where the problem is once we applied both patches.
>>>> For example assume the list has three path, and all path is not NVME_ANA_OPTIMIZED:
>>>> head->next = ns1;
>>>> ns1->next = ns2;
>>>> ns2->next = head;
>>>> old->next = ns2;
>>>>
>>> And this is where I have issues with.
>>> Where does 'old' come from?
>>> Clearly it was part of the list at one point; so what happened to it?
>> I explained this earlier.
>> In nvme_ns_remove, there is a hole between list_del_rcu and
>> nvme_mpath_clear_current_path. If head->current_path is the "old", and
>> the "old" is removing. The "old" is already removed from the list by
>> list_del_rcu, but head->current_path is not clear to NULL by
>> nvme_mpath_clear_current_path.
>> Find path is race with nvme_ns_remove, use the "old" pass to
>> nvme_round_robin_path to find path.
>
> Ah. So this should be better:
>
> @@ -202,10 +202,12 @@ static struct nvme_ns *__nvme_find_path(struct nvme_ns_head *head, int node)
> static struct nvme_ns *nvme_next_ns(struct nvme_ns_head *head,
> struct nvme_ns *ns)
> {
> - ns = list_next_or_null_rcu(&head->list, &ns->siblings, struct nvme_ns,
> - siblings);
> - if (ns)
> - return ns;
> + if (ns && !test_bit(NVME_NS_REMOVING, &ns->flags)) {
> + ns = list_next_or_null_rcu(&head->list, &ns->siblings,
> + struct nvme_ns, siblings);
> + if (ns)
> + return ns;
> + }
> return list_first_or_null_rcu(&head->list, struct nvme_ns, siblings);
> }
>
> The 'NVME_NS_REMOVING' bit is set before list_del_rcu() is called, so it should guard against the issue you mentioned.
Looks useless, it is still infinite loop. You can check the workflow for the scenario I mentioned.
>
> Cheers,
>
> Hannes
next prev parent reply other threads:[~2021-02-02 1:13 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-27 10:30 [PATCH v2] nvme-multipath: Early exit if no path is available Daniel Wagner
2021-01-27 10:34 ` Hannes Reinecke
2021-01-27 16:49 ` Christoph Hellwig
2021-01-28 1:31 ` Chao Leng
2021-01-28 7:58 ` Daniel Wagner
2021-01-28 9:18 ` Chao Leng
2021-01-28 9:23 ` Hannes Reinecke
2021-01-29 1:18 ` Chao Leng
2021-01-28 9:40 ` Daniel Wagner
2021-01-29 1:23 ` Chao Leng
2021-01-29 1:42 ` Sagi Grimberg
2021-01-29 3:07 ` Chao Leng
2021-01-29 3:30 ` Sagi Grimberg
2021-01-29 3:36 ` Chao Leng
2021-01-29 7:06 ` Hannes Reinecke
[not found] ` <81b22bbf-4dd3-6161-e63a-9699690a4e4f@huawei.com>
[not found] ` <715dd943-0587-be08-2840-e0948cf0bc62@suse.de>
[not found] ` <eb131d8f-f009-42e7-105d-58b84060f0dd@huawei.com>
[not found] ` <ac019690-7f02-d28c-ed58-bfc8c1d48879@suse.de>
2021-02-01 2:16 ` Chao Leng
2021-02-01 7:29 ` Hannes Reinecke
2021-02-01 8:47 ` Chao Leng
2021-02-01 8:57 ` Hannes Reinecke
2021-02-01 9:40 ` Chao Leng
2021-02-01 10:45 ` Hannes Reinecke
2021-02-02 1:12 ` Chao Leng [this message]
2021-01-28 1:36 ` 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=6ef6df55-318b-887d-b14f-62cae6419b4a@huawei.com \
--to=lengchao@huawei.com \
--cc=axboe@fb.com \
--cc=dwagner@suse.de \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).