linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: james.smart@broadcom.com (James Smart)
Subject: [PATCH] nvme: re-enable clean shutdown
Date: Fri, 25 May 2018 08:53:36 -0700	[thread overview]
Message-ID: <78db23fc-6bf6-68b5-a298-6a44b0ece5ca@broadcom.com> (raw)
In-Reply-To: <20180525090524.58845-1-hare@suse.de>



On 5/25/2018 2:05 AM, Hannes Reinecke wrote:
> Commit bb06ec31452f ("nvme: expand nvmf_check_if_ready checks")
> masked out all commands during shutdown, causing the nvme core
> to never send the shutdown command to the target.
> With this patch clean shutdown is re-enabled.
>
> Fixes: bb06ec31452f ("nvme: expand nvmf_check_if_ready checks")
> Cc: James Smart <james.smart at broadcom.com>
> Signed-off-by: Hannes Reinecke <hare at suse.com>
> ---
>   drivers/nvme/host/fabrics.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
>
> diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
> index 1c27f862dc45..13c5d3155c41 100644
> --- a/drivers/nvme/host/fabrics.c
> +++ b/drivers/nvme/host/fabrics.c
> @@ -546,6 +546,17 @@ blk_status_t nvmf_check_if_ready(struct nvme_ctrl *ctrl, struct request *rq,
>   
>   	switch (ctrl->state) {
>   	case NVME_CTRL_DELETING:
> +		if (!is_connected)
> +			goto reject_or_queue_io;
> +		/*
> +		 * We need to send shutdown commands to the
> +		 * target when deleting the controller.
> +		 */
> +		if (cmd->common.opcode == nvme_fabrics_command &&
> +		    (cmd->fabrics.fctype == nvme_fabrics_type_property_get ||
> +		     cmd->fabrics.fctype == nvme_fabrics_type_property_set))
> +			return BLK_STS_OK;
> +
>   		goto reject_io;
>   
>   	case NVME_CTRL_NEW:

yep. sounds good.

-- james

Reviewed-by:? James Smart? <james.smart at broadcom.com>

  parent reply	other threads:[~2018-05-25 15:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-25  9:05 [PATCH] nvme: re-enable clean shutdown Hannes Reinecke
2018-05-25 13:47 ` Christoph Hellwig
2018-05-25 15:53 ` James Smart [this message]
2018-05-28  7:20   ` Christoph Hellwig

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=78db23fc-6bf6-68b5-a298-6a44b0ece5ca@broadcom.com \
    --to=james.smart@broadcom.com \
    /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).