[PATCH] nvme-core: fix io interrupt when work with dm-multipah

Chao Leng lengchao at huawei.com
Thu Aug 6 01:52:42 EDT 2020



On 2020/8/5 23:29, Keith Busch wrote:
> On Wed, Aug 05, 2020 at 02:40:48PM +0800, Chao Leng wrote:
>> John, Wat do you think about if delete translate NVME_SC_CMD_INTERRUPTED
>> to BLK_STS_TARGET? Thank you.
> 
> Perhaps BLK_STS_TARGET should only failfast for REQ_FAILFAST_DEV rather
> than REQ_FAILFAST_PATH.
> 
Now we transate NVME_SC_LBA_RANGE, NVME_SC_CMD_INTERRUPTED, NVME_SC_NS_NOT_READY
to BLK_STS_TARGET. NVME_SC_LBA_RANGE should failfast, because retry can not success.
NVME_SC_NS_NOT_READY may retry success, but the probality is very low.
NVME_SC_CMD_INTERRUPTED need retry, according to protocol define, retry will success.

So it is recommended that add the local preferential retry mechanism, like this:
---
  drivers/nvme/host/core.c | 2 +-
  drivers/nvme/host/nvme.h | 8 ++++++++
  2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 1a1ad5e5212c..3d39528051ad 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -242,7 +242,7 @@ static blk_status_t nvme_error_status(u16 status)

  static inline bool nvme_req_needs_retry(struct request *req)
  {
-	if (blk_noretry_request(req))
+	if (!nvme_req_local_retry(req) && blk_noretry_request(req))
  		return false;
  	if (nvme_req(req)->status & NVME_SC_DNR)
  		return false;
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index c0f4226d3299..17064455f2db 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -710,4 +710,12 @@ void nvme_hwmon_init(struct nvme_ctrl *ctrl);
  static inline void nvme_hwmon_init(struct nvme_ctrl *ctrl) { }
  #endif

+static inline bool nvme_req_local_retry(struct request *req)
+{
+	if (nvme_req(req)->status == NVME_SC_CMD_INTERRUPTED)
+		return true;
+	return false;
+}
+
+
  #endif /* _NVME_H */
-- 



More information about the Linux-nvme mailing list