public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Keith Busch <kbusch@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	Keith Busch <keith.busch@wdc.com>,
	linux-nvme@lists.infradead.org
Subject: Re: [PATCHv6] nvme: allow to re-attach namespaces after all paths are down
Date: Tue, 22 Jun 2021 08:21:53 +0200	[thread overview]
Message-ID: <b4637359-9846-4086-2fc2-a1a990933c7b@suse.de> (raw)
In-Reply-To: <20210621172653.GC1268033@dhcp-10-100-145-180.wdc.com>

On 6/21/21 7:26 PM, Keith Busch wrote:
> On Wed, Jun 09, 2021 at 05:01:18PM +0200, Hannes Reinecke wrote:
>> -void nvme_mpath_remove_disk(struct nvme_ns_head *head)
>> +void nvme_mpath_check_last_path(struct nvme_ns_head *head)
>>   {
>> +	bool last_path = false;
>>   	if (!head->disk)
>>   		return;
>> -	if (head->disk->flags & GENHD_FL_UP) {
>> -		nvme_cdev_del(&head->cdev, &head->cdev_device);
>> -		del_gendisk(head->disk);
>> +
>> +	/* Synchronize with nvme_init_ns_head() */
>> +	mutex_lock(&head->subsys->lock);
>> +	if (list_empty(&head->list))
>> +		last_path = true;
>> +	mutex_unlock(&head->subsys->lock);
>> +	if (last_path) {
>> +		kblockd_schedule_work(&head->requeue_work);
>> +		if (head->disk->flags & GENHD_FL_UP) {
>> +			nvme_cdev_del(&head->cdev, &head->cdev_device);
>> +			del_gendisk(head->disk);
>> +		}
>>   	}
>> +}
> 
> This is being called when a path is removed. If it is the last path, the
> head's block device is being deleted. If a live head reference is held,
> and the a path reconnects, the code will find the previous head, but the
> disk is gone and it's not coming back, so the new connection can't be
> used.
> 
Good point. But that can be fixed by removing the ns_head from the 
subsystem list at this check rather than in nvme_free_ns_head().
Will be sending an updated version.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@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

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2021-06-22  6:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09 15:01 [PATCHv6] nvme: allow to re-attach namespaces after all paths are down Hannes Reinecke
2021-06-21  6:38 ` Christoph Hellwig
2021-06-21  7:33   ` Hannes Reinecke
2021-06-21 17:26 ` Keith Busch
2021-06-22  6:21   ` Hannes Reinecke [this message]
2021-06-21 18:13 ` Sagi Grimberg
2021-06-22  6:31   ` 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=b4637359-9846-4086-2fc2-a1a990933c7b@suse.de \
    --to=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=keith.busch@wdc.com \
    --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