All of lore.kernel.org
 help / color / mirror / Atom feed
From: jsmart2021@gmail.com (James Smart)
Subject: [PATCH v2 2/7] nvme: revise nvme_set_queue_count to return error on some nvme status codes
Date: Fri, 11 May 2018 17:50:23 -0700	[thread overview]
Message-ID: <20180512005028.29661-3-jsmart2021@gmail.com> (raw)
In-Reply-To: <20180512005028.29661-1-jsmart2021@gmail.com>

If the SET_FEATURES command failed with an nvme completion failure only,
the current code ignores the failure and lets the controller continue to
initialize but with the io queue count degraded (not existent).

In cases where the failure may have been due to the transport detecting
an error condition or a connectivity loss, the nvme status failure was
manufactured and not a valid representation of the controller. It is better
to fail the command so that a subsequent (re)connect can resolve the state.

The status codes that transports may generate are NVME_SC_ABORT_REQ and
NVME_SC_INTERNAL. In those cases, return a positive error value with the
value being the status code.

Signed-off-by: James Smart <james.smart at broadcom.com>

---
v2:
  replaced logic in fc.c which checked for io queue count of zero
  and recognized failure with change to nvme_set_queue_count() to
  return error if one of the transport error completion values

 drivers/nvme/host/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index f3779f350769..7a39ce8d9d5e 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1007,7 +1007,8 @@ int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count)
 
 	status = nvme_set_features(ctrl, NVME_FEAT_NUM_QUEUES, q_count, NULL, 0,
 			&result);
-	if (status < 0)
+	if (status < 0 ||
+	    status == NVME_SC_ABORT_REQ || status == NVME_SC_INTERNAL)
 		return status;
 
 	/*
-- 
2.13.1

  parent reply	other threads:[~2018-05-12  0:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-12  0:50 [PATCH v2 0/7] nvme_fc: asynchronous controller create and simple discovery James Smart
2018-05-12  0:50 ` [PATCH v2 1/7] nvme: remove unnecessary controller subnqn validation James Smart
2018-05-12 13:36   ` Christoph Hellwig
2018-05-25  9:11   ` Christoph Hellwig
2018-05-12  0:50 ` James Smart [this message]
2018-05-12 13:34   ` [PATCH v2 2/7] nvme: revise nvme_set_queue_count to return error on some nvme status codes Christoph Hellwig
2018-05-14 15:08     ` James Smart
2018-05-12  0:50 ` [PATCH v2 3/7] nvme_fc: remove setting DNR on exception conditions James Smart
2018-05-25  9:11   ` Christoph Hellwig
2018-05-12  0:50 ` [PATCH v2 4/7] nvme_fc: remove reinit_request routine James Smart
2018-05-12 13:35   ` Christoph Hellwig
2018-05-12  0:50 ` [PATCH v2 5/7] nvme_fc: change controllers first connect to use reconnect path James Smart
2018-05-12  0:50 ` [PATCH v2 6/7] nvme_fc: fix nulling of queue data on reconnect James Smart
2018-05-12  0:50 ` [PATCH v2 7/7] nvme_fc: add 'nvme_discovery' sysfs attribute to fc transport device James Smart

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=20180512005028.29661-3-jsmart2021@gmail.com \
    --to=jsmart2021@gmail.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 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.