Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Sagi Grimberg <sagi@grimberg.me>
Cc: Keith Busch <kbusch@kernel.org>, Christoph Hellwig <hch@lst.de>,
	linux-nvme@lists.infradead.org
Subject: Re: [PATCH RFC for-5.8-rc] nvme-core: fix deadlock in disconnect during scan_work and/or ana_work
Date: Mon, 29 Jun 2020 08:49:35 +0200	[thread overview]
Message-ID: <20200629064935.GC30821@lst.de> (raw)
In-Reply-To: <20200626174733.116093-1-sagi@grimberg.me>

> +	/*
> +	 * Controller deletion started, we may issue I/O, block and prevent
> +	 * the controller deletion process from completing
> +	 */
> +	if (ctrl->state == NVME_CTRL_DELETE_START)
> +		return;
> +
>  	/* No tagset on a live ctrl means IO queues could not created */
>  	if (ctrl->state != NVME_CTRL_LIVE || !ctrl->tagset)

Can we merge the checks into a single one?

> @@ -3913,6 +3932,9 @@ void nvme_remove_namespaces(struct nvme_ctrl *ctrl)
>  	if (ctrl->state == NVME_CTRL_DEAD)
>  		nvme_kill_queues(ctrl);
>  
> +	/* prevent mpath I/O before removing namespaces */
> +	nvme_change_ctrl_state(ctrl, NVME_CTRL_DELETING);

So with the DEAD state above isn't this going to cause problems,
shouldn't this be:

	if (ctrl->state == NVME_CTRL_DEAD)
		nvme_kill_queues(ctrl);
	else
		nvme_change_ctrl_state(ctrl, NVME_CTRL_DELETING);

But even with that I'm not sure it does the right thing for the direct
call from the PCIe code.

Also I wonder about the state naming.  Shouldn't NVME_CTRL_DELETE_START
stay as NVME_CTRL_DELETING and the new state could be
NVME_CTRL_NS_REMOVAL? or NVME_CTRL_DELETED?  But with any name we'll
need to document the difference between the two removal states.

> +	/*
> +	 * We don't treat NVME_CTRL_DELETE_START as a disabled path
> +	 * as we I/O should still be able to complete assuming that
> +	 * the controller is connected, otherwize it'll fail
> +	 * immediately and return to the requeue list.
> +	 */

This needs to run through a spell and grammar checker :)

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

  reply	other threads:[~2020-06-29  6:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-26 17:47 [PATCH RFC for-5.8-rc] nvme-core: fix deadlock in disconnect during scan_work and/or ana_work Sagi Grimberg
2020-06-29  6:49 ` Christoph Hellwig [this message]
2020-06-29  7:44   ` Sagi Grimberg

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=20200629064935.GC30821@lst.de \
    --to=hch@lst.de \
    --cc=kbusch@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