[PATCH] nvme: allow to re-attach namespaces after all paths are down

Hannes Reinecke hare at suse.de
Mon May 10 22:29:37 PDT 2021


On 5/10/21 5:53 PM, Keith Busch wrote:
> On Mon, May 10, 2021 at 04:49:06PM +0200, Hannes Reinecke wrote:
>> @@ -3605,16 +3608,26 @@ static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid,
>>   		head->shared = is_shared;
>>   	} else {
>>   		ret = -EINVAL;
>> -		if (!is_shared || !head->shared) {
>> -			dev_err(ctrl->device,
>> -				"Duplicate unshared namespace %d\n", nsid);
>> -			goto out_put_ns_head;
>> -		}
>> -		if (!nvme_ns_ids_equal(&head->ids, ids)) {
>> -			dev_err(ctrl->device,
>> -				"IDs don't match for shared namespace %d\n",
>> +		/*
>> +		 * If multipath is enabled we might hit an ns head with no
>> +		 * paths, but that doesn't indicate it's a shared namespace.
>> +		 */
>> +		if (!nvme_ns_head_multipath(head) ||
>> +		    !list_empty(&head->list)) {
>> +			if (!is_shared || !head->shared) {
>> +				dev_err(ctrl->device,
>> +					"Duplicate unshared namespace %d\n", nsid);
>> +				goto out_put_ns_head;
>> +			}
> 
> If not multipath, then it is not shared. The above will fail attaching
> single-path namespaces to a known head.
> 
Right. Will be fixing it up.

> The rest is similar to something I was working on too, though, so I
> think it's the right direction.
> 
> 
At long last, hope is on the horizon :-)

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare at suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer



More information about the Linux-nvme mailing list