summaryrefslogtreecommitdiffstats
path: root/drivers/nvme
diff options
context:
space:
mode:
authorJunxiong Guan <guanjunxiong@huawei.com>2017-04-21 12:59:07 +0200
committerChristoph Hellwig <hch@lst.de>2017-04-21 16:41:56 +0200
commite02ab0230489461fd9fdd8028841dae6f03a4874 (patch)
treea79eccba5ffc641c0488479110f6244c89b3731f /drivers/nvme
parent7776db1ccc123d5944a8c170c9c45f7e91d49643 (diff)
downloadlinux-e02ab0230489461fd9fdd8028841dae6f03a4874.tar.gz
linux-e02ab0230489461fd9fdd8028841dae6f03a4874.tar.bz2
linux-e02ab0230489461fd9fdd8028841dae6f03a4874.zip
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@huawei.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/nvme')
-rw-r--r--drivers/nvme/host/core.c14
1 files changed, 14 insertions, 0 deletions
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;
}
}