linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvme-core: initialize status to NVME_SC_HOST_PATH_ERROR
@ 2021-04-12 23:45 Yuanyuan Zhong
  2021-04-13  3:19 ` Chaitanya Kulkarni
  0 siblings, 1 reply; 7+ messages in thread
From: Yuanyuan Zhong @ 2021-04-12 23:45 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi; +Cc: linux-nvme, cachen, Yuanyuan Zhong

Block layer blk_end_sync_rq() silently drops blk_status_t error.
When ->queue_rq returns error, nvme driver should set nvme status
explicitly. Otherwise the passthrough command may take the stale
status as result. A typical value zero will be interpreted as
NVME_SC_SUCCESS, despite the dispatching error from ->queue_rq.

Instead of trying to fix it for every error return, this change
initialize the status to NVME_SC_HOST_PATH_ERROR during
nvme_alloc_request().

Fixes: 27fa9bc54541 ("nvme: split nvme status from block req->errors")
Signed-off-by: Yuanyuan Zhong <yzhong@purestorage.com>
Signed-off-by: Casey Chen <cachen@purestorage.com>
---
 drivers/nvme/host/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 0896e21642be..f22323d02755 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -580,6 +580,7 @@ static inline void nvme_clear_nvme_request(struct request *req)
 		nvme_req(req)->flags = 0;
 		req->rq_flags |= RQF_DONTPREP;
 	}
+	nvme_req(req)->status = NVME_SC_HOST_PATH_ERROR;
 }
 
 static inline unsigned int nvme_req_op(struct nvme_command *cmd)
-- 
2.31.1


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

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

end of thread, other threads:[~2021-04-15 22:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 23:45 [PATCH] nvme-core: initialize status to NVME_SC_HOST_PATH_ERROR Yuanyuan Zhong
2021-04-13  3:19 ` Chaitanya Kulkarni
2021-04-14 17:08   ` [PATCH v2] " Yuanyuan Zhong
2021-04-15 19:30     ` Keith Busch
2021-04-15 20:17       ` Keith Busch
2021-04-15 22:11         ` Yuanyuan Zhong
2021-04-15 22:58           ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).