Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme:let dm-mpath distinguish nvme error codes,no retry
@ 2017-04-18 13:19 Guan Junxiong
  2017-04-21  6:52 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Guan Junxiong @ 2017-04-18 13:19 UTC (permalink / raw)


From: Junxiong Guan <guanjunxiong@huawei.com>

Currently most IOs which return the nvme error codes are retried on
the other path if those IOs returns EIO from NVMe driver. This
patch let Multipath distinguish nvme media error codes and some
generic or cmd-specific nvme error codes so that multipath will
not retry those kinds of IO, to save bandwidth.
---
 drivers/nvme/host/core.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 9bf758e3c911..7b4abd7926e6 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -71,8 +71,29 @@ static int nvme_error_status(struct request *req)
 	switch (nvme_req(req)->status & 0x7ff) {
 	case NVME_SC_SUCCESS:
 		return 0;
+
+	/*
+	 * Generic Command Status:
+	 */
+	case NVME_SC_CMD_SEQ_ERROR:
+		return -EILSEQ;
 	case NVME_SC_CAP_EXCEEDED:
 		return -ENOSPC;
+
+	/*
+	 * I/O Command Set Specific - NVM commands
+	 */
+	case NVME_SC_ONCS_NOT_SUPPORTED:
+		return -EOPNOTSUPP;
+
+	/*
+	 * Media and Integrity Erros
+	 */
+	case NVME_SC_WRITE_FAULT:
+	case NVME_SC_READ_ERROR:
+	case NVME_SC_UNWRITTEN_BLOCK:
+		return -ENODATA;
+
 	default:
 		return -EIO;
 	}
-- 
2.11.1

This patch is base on the request-errors branch of the git tree:
git://git.infradead.org/users/hch/block.git

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

* [PATCH] nvme:let dm-mpath distinguish nvme error codes,no retry
  2017-04-18 13:19 [PATCH] nvme:let dm-mpath distinguish nvme error codes,no retry Guan Junxiong
@ 2017-04-21  6:52 ` Christoph Hellwig
  2017-04-21 10:43   ` Guan Junxiong
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2017-04-21  6:52 UTC (permalink / raw)


Hi Guang,

I'll need your Signed-off-by to apply this patch.

Also I'd like to update subject and comments a bit, are you fine with
the version below?

---
>From 7a252de505d4327a93fecf321c72691b14caa727 Mon Sep 17 00:00:00 2001
From: Junxiong Guan <guanjunxiong@huawei.com>
Date: Tue, 18 Apr 2017 21:19:52 +0800
Subject: nvme: let dm-mpath distinguish nvme error codes

Currently most IOs which return the nvme error codes are retried on
the other path if those IOs returns EIO from NVMe driver. This
patch let Multipath distinguish nvme media error codes and some
generic or cmd-specific nvme error codes so that multipath will
not retry those kinds of IO, to save bandwidth.

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

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 8dc664798293..263946b23628 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -75,6 +75,20 @@ static int nvme_error_status(struct request *req)
 		return -ENOSPC;
 	default:
 		return -EIO;
+
+	/*
+	 * XXX: these errors are a nasty side-band protocol to
+	 * drivers/md/dm-mpath.c:noretry_error() that aren't documented
+	 * anywhere..
+	 */
+	case NVME_SC_CMD_SEQ_ERROR:
+		return -EILSEQ;
+	case NVME_SC_ONCS_NOT_SUPPORTED:
+		return -EOPNOTSUPP;
+	case NVME_SC_WRITE_FAULT:
+	case NVME_SC_READ_ERROR:
+	case NVME_SC_UNWRITTEN_BLOCK:
+		return -ENODATA;
 	}
 }
 
-- 
2.11.0

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

* [PATCH] nvme:let dm-mpath distinguish nvme error codes,no retry
  2017-04-21  6:52 ` Christoph Hellwig
@ 2017-04-21 10:43   ` Guan Junxiong
  2017-04-21 10:59     ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Guan Junxiong @ 2017-04-21 10:43 UTC (permalink / raw)



Hi Christoph,
  Thanks for your review.

On 2017/4/21 14:52, Christoph Hellwig wrote:
> Hi Guang,
>
> I'll need your Signed-off-by to apply this patch.
>
> Also I'd like to update subject and comments a bit, are you fine with
> the version below?
>


 It's fine.  I have signed-off-by the previous patch as the version below.
 It would be nice that you would apply this version.


---
>From 23d7fd1b4b3d61d404d5562aab32d8a7ff7d72e4 Mon Sep 17 00:00:00 2001
From: Junxiong Guan <guanjunxiong@huawei.com>
Date: Tue, 18 Apr 2017 21:19:52 +0800
Subject: [PATCH] nvme: let dm-mpath distinguish nvme error codes

Currently most IOs which return the nvme error codes are retried on
the other path if those IOs returns EIO from NVMe driver. This
patch let Multipath distinguish nvme media error codes and some
generic or cmd-specific nvme error codes so that multipath will
not retry those kinds of IO, to save bandwidth.

Signed-off-by: Junxiong Guan <guanjunxiong at huawei.com>
---
 drivers/nvme/host/core.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 9bf758e3c911..6dcd7a123b50 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -75,6 +75,20 @@ static int nvme_error_status(struct request *req)
 		return -ENOSPC;
 	default:
 		return -EIO;
+
+	/*
+	 * XXX: these errors are a nasty side-band protocol to
+	 * drivers/md/dm-mpath.c:noretry_error() that aren't documented
+	 * anywhere..
+	 */
+	case NVME_SC_CMD_SEQ_ERROR:
+		return -EILSEQ;
+	case NVME_SC_ONCS_NOT_SUPPORTED:
+		return -EOPNOTSUPP;
+	case NVME_SC_WRITE_FAULT:
+	case NVME_SC_READ_ERROR:
+	case NVME_SC_UNWRITTEN_BLOCK:
+		return -ENODATA;
 	}
 }

-- 
2.11.1

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

* [PATCH] nvme:let dm-mpath distinguish nvme error codes,no retry
  2017-04-21 10:43   ` Guan Junxiong
@ 2017-04-21 10:59     ` Christoph Hellwig
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2017-04-21 10:59 UTC (permalink / raw)


Applied to nvme-4.12.

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

end of thread, other threads:[~2017-04-21 10:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-18 13:19 [PATCH] nvme:let dm-mpath distinguish nvme error codes,no retry Guan Junxiong
2017-04-21  6:52 ` Christoph Hellwig
2017-04-21 10:43   ` Guan Junxiong
2017-04-21 10:59     ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox