All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Hannes Reinecke <hare@suse.de>
Cc: Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	Keith Busch <keith.busch@wdc.com>,
	linux-nvme@lists.infradead.org
Subject: Re: [PATCHv8] nvme: fix refcounting imbalance when all paths are down
Date: Fri, 16 Jul 2021 10:23:20 +0200	[thread overview]
Message-ID: <20210716082320.GA15623@lst.de> (raw)
In-Reply-To: <20210624085546.123824-1-hare@suse.de>

> Changes to v7:
> - Move the list_del() call outside of nvme_mpath_check_last_path()
> Changes to v6:
> - Move the list_del() into nvme_mpath_check_last_path()
> - Drop the tests for GENHD_FL_UP
> Changes to v5:
> - Synchronize between nvme_init_ns_head() and nvme_mpath_check_last_path()
> - Check for removed gendisk in nvme_ns_head_submit_bio()
> Changes to v4:
> - Call del_gendisk() in nvme_mpath_check_last_path() to avoid deadlock
> Changes to v3:
> - Simplify if() clause to detect duplicate namespaces
> Changes to v2:
> - Drop memcpy() statement
> Changes to v1:
> - Always check NSIDs after reattach

The changelog belongs under the ---.

The patch also does not actually apply due to changes in 5.14-rc, so
please respin it.

> -	nvme_mpath_check_last_path(ns);
> +	/* Synchronize with nvme_init_ns_head() */
> +	mutex_lock(&ns->head->subsys->lock);
> +	if (list_empty(&ns->head->list)) {
> +		list_del_init(&ns->head->entry);
> +		last_path = true;
> +	}
> +	mutex_unlock(&ns->head->subsys->lock);
> +	if (last_path)
> +		nvme_mpath_check_last_path(ns->head);

And while we're at it - nvme_mpath_check_last_path is a little misnamed
now as we know this is the last path when we call it now.  Maybe this
function should inherit the nvme_mpath_remove_disk name and ther other
half should become nvme_mpath_cleanup_disk?

> +void nvme_mpath_remove_disk(struct nvme_ns_head *head)
> +{
> +	if (!head->disk)
> +		return;
>  	blk_set_queue_dying(head->disk->queue);
>  	/* make sure all pending bios are cleaned up */
>  	kblockd_schedule_work(&head->requeue_work);
>  	flush_work(&head->requeue_work);
>  	blk_cleanup_queue(head->disk->queue);
> -	if (!test_bit(NVME_NSHEAD_DISK_LIVE, &head->flags)) {
> +	if (!test_and_clear_bit(NVME_NSHEAD_DISK_LIVE, &head->flags)) {

This is where the conflict happens.  But given that with the above
changes we can't find the ns_head any more once nvme_ns_remove
decided it actually is the last path I don't think we even need to
clear NVME_NSHEAD_DISK_LIVE any more.  This was only needed when we
tried to reuse the ns_head.

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

  parent reply	other threads:[~2021-07-16  8:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-24  8:55 [PATCHv8] nvme: fix refcounting imbalance when all paths are down Hannes Reinecke
2021-07-13  9:37 ` Hannes Reinecke
2021-07-13 21:23 ` Keith Busch
2021-07-16  8:23 ` Christoph Hellwig [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-07-16 11:30 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=20210716082320.GA15623@lst.de \
    --to=hch@lst.de \
    --cc=hare@suse.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.