Linux-NVME Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] nvme: always treat DNR status as no-retryable
@ 2019-11-26 13:37 Hannes Reinecke
  2019-11-26 16:15 ` Keith Busch
  2019-11-26 16:22 ` Christoph Hellwig
  0 siblings, 2 replies; 6+ messages in thread
From: Hannes Reinecke @ 2019-11-26 13:37 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Keith Busch, Sagi Grimberg, linux-nvme, Hannes Reinecke

If the DNR bit is set in the command status we should not retry
the command, irrespective of what the actual status is.
So map it directly to BLK_STS_TARGET to inform upper layers to
not retry the command, not even on another path.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/nvme/host/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 752a40daf2b3..f015f6e91c85 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -198,6 +198,9 @@ static inline bool nvme_ns_has_pi(struct nvme_ns *ns)
 
 static blk_status_t nvme_error_status(u16 status)
 {
+	if (status & NVME_SC_DNR)
+		return BLK_STS_TARGET;
+
 	switch (status & 0x7ff) {
 	case NVME_SC_SUCCESS:
 		return BLK_STS_OK;
-- 
2.16.4


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

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

* Re: [PATCH] nvme: always treat DNR status as no-retryable
  2019-11-26 13:37 [PATCH] nvme: always treat DNR status as no-retryable Hannes Reinecke
@ 2019-11-26 16:15 ` Keith Busch
  2019-11-26 16:34   ` Hannes Reinecke
  2019-11-26 16:22 ` Christoph Hellwig
  1 sibling, 1 reply; 6+ messages in thread
From: Keith Busch @ 2019-11-26 16:15 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: Christoph Hellwig, linux-nvme, Sagi Grimberg

On Tue, Nov 26, 2019 at 02:37:49PM +0100, Hannes Reinecke wrote:
> If the DNR bit is set in the command status we should not retry
> the command, irrespective of what the actual status is.
> So map it directly to BLK_STS_TARGET to inform upper layers to
> not retry the command, not even on another path.

Why can't a DNR error be path specific, like if I detach a namespace
from one of the controllers?
 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/nvme/host/core.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 752a40daf2b3..f015f6e91c85 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -198,6 +198,9 @@ static inline bool nvme_ns_has_pi(struct nvme_ns *ns)
>  
>  static blk_status_t nvme_error_status(u16 status)
>  {
> +	if (status & NVME_SC_DNR)
> +		return BLK_STS_TARGET;
> +
>  	switch (status & 0x7ff) {
>  	case NVME_SC_SUCCESS:
>  		return BLK_STS_OK;
> -- 

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

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

* Re: [PATCH] nvme: always treat DNR status as no-retryable
  2019-11-26 13:37 [PATCH] nvme: always treat DNR status as no-retryable Hannes Reinecke
  2019-11-26 16:15 ` Keith Busch
@ 2019-11-26 16:22 ` Christoph Hellwig
  2019-11-26 16:28   ` Hannes Reinecke
  1 sibling, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2019-11-26 16:22 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: Keith Busch, Christoph Hellwig, linux-nvme, Sagi Grimberg

On Tue, Nov 26, 2019 at 02:37:49PM +0100, Hannes Reinecke wrote:
> If the DNR bit is set in the command status we should not retry
> the command, irrespective of what the actual status is.
> So map it directly to BLK_STS_TARGET to inform upper layers to
> not retry the command, not even on another path.

We've been there before, have we?  What is your use case.  I.e.
what part of the kernel is retrying what command that you don't
want to be retried?

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

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

* Re: [PATCH] nvme: always treat DNR status as no-retryable
  2019-11-26 16:22 ` Christoph Hellwig
@ 2019-11-26 16:28   ` Hannes Reinecke
  0 siblings, 0 replies; 6+ messages in thread
From: Hannes Reinecke @ 2019-11-26 16:28 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Keith Busch, Sagi Grimberg, linux-nvme

On 11/26/19 5:22 PM, Christoph Hellwig wrote:
> On Tue, Nov 26, 2019 at 02:37:49PM +0100, Hannes Reinecke wrote:
>> If the DNR bit is set in the command status we should not retry
>> the command, irrespective of what the actual status is.
>> So map it directly to BLK_STS_TARGET to inform upper layers to
>> not retry the command, not even on another path.
> 
> We've been there before, have we?  What is your use case.  I.e.
> what part of the kernel is retrying what command that you don't
> want to be retried?
> 
EG Namespace not ready.
Some NetApp arrays return "namespace not ready" for either a temporary 
issue (eg during array failover or whatnot), and then will have the DNR 
bit not set (as you can retry, and eventually the namespace will become 
ready). Or they return 'namepace not ready' for cases where the 
namespace has been unmapped, for which is retry is pointless, and hence 
have the DNR bit set.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke            Teamlead Storage & Networking
hare@suse.de                              +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)

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

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

* Re: [PATCH] nvme: always treat DNR status as no-retryable
  2019-11-26 16:15 ` Keith Busch
@ 2019-11-26 16:34   ` Hannes Reinecke
  2019-11-26 16:39     ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Hannes Reinecke @ 2019-11-26 16:34 UTC (permalink / raw)
  To: Keith Busch; +Cc: Christoph Hellwig, linux-nvme, Sagi Grimberg

On 11/26/19 5:15 PM, Keith Busch wrote:
> On Tue, Nov 26, 2019 at 02:37:49PM +0100, Hannes Reinecke wrote:
>> If the DNR bit is set in the command status we should not retry
>> the command, irrespective of what the actual status is.
>> So map it directly to BLK_STS_TARGET to inform upper layers to
>> not retry the command, not even on another path.
> 
> Why can't a DNR error be path specific, like if I detach a namespace
> from one of the controllers?
>   
I've discussed the very same question with Fred Knight, and according to 
him the 'DNR' bit is _command_ specific, ie _this particular command_ 
should not be retried.
Any eventual alternative path should not be considered.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke            Teamlead Storage & Networking
hare@suse.de                              +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)

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

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

* Re: [PATCH] nvme: always treat DNR status as no-retryable
  2019-11-26 16:34   ` Hannes Reinecke
@ 2019-11-26 16:39     ` Christoph Hellwig
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2019-11-26 16:39 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: Keith Busch, Christoph Hellwig, linux-nvme, Sagi Grimberg

On Tue, Nov 26, 2019 at 05:34:21PM +0100, Hannes Reinecke wrote:
> On 11/26/19 5:15 PM, Keith Busch wrote:
>> On Tue, Nov 26, 2019 at 02:37:49PM +0100, Hannes Reinecke wrote:
>>> If the DNR bit is set in the command status we should not retry
>>> the command, irrespective of what the actual status is.
>>> So map it directly to BLK_STS_TARGET to inform upper layers to
>>> not retry the command, not even on another path.
>>
>> Why can't a DNR error be path specific, like if I detach a namespace
>> from one of the controllers?
>>   
> I've discussed the very same question with Fred Knight, and according to 
> him the 'DNR' bit is _command_ specific, ie _this particular command_ 
> should not be retried.
> Any eventual alternative path should not be considered.

To quote from the spec:

"Do Not Retry (DNR): If set to ‘1’, indicates that if the same command is
re-submitted to any controller in the NVM subsystem, then that re-submitted
command is expected to fail. If cleared to ‘0’, indicates that the same
command may succeed if retried."

So yes, we should generally not submit it on another path, which is in
fact what we already do if you look at nvme_complete_rq and
nvme_req_needs_retry.

Besides not not needing the BLK_STS_TARGET remap that remap also is a
horrible bad idea given that is loses way too much information.

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

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

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-26 13:37 [PATCH] nvme: always treat DNR status as no-retryable Hannes Reinecke
2019-11-26 16:15 ` Keith Busch
2019-11-26 16:34   ` Hannes Reinecke
2019-11-26 16:39     ` Christoph Hellwig
2019-11-26 16:22 ` Christoph Hellwig
2019-11-26 16:28   ` Hannes Reinecke

Linux-NVME Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-nvme/0 linux-nvme/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-nvme linux-nvme/ https://lore.kernel.org/linux-nvme \
		linux-nvme@lists.infradead.org
	public-inbox-index linux-nvme

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-nvme


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git