linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvme: re-enable clean shutdown
@ 2018-05-25  9:05 Hannes Reinecke
  2018-05-25 13:47 ` Christoph Hellwig
  2018-05-25 15:53 ` James Smart
  0 siblings, 2 replies; 4+ messages in thread
From: Hannes Reinecke @ 2018-05-25  9:05 UTC (permalink / raw)


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:
-- 
2.12.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-05-28  7:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2018-05-28  7:20   ` Christoph Hellwig

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).