[PATCH 1/2] nvme-core: use I/O timeout for I/O requests

Chaitanya Kulkarni chaitanya.kulkarni at wdc.com
Tue Sep 1 22:13:07 EDT 2020


In the function __nvme_submimt_sync_cmd() it uses ADMIN_TIMEOUT when
caller doesn't specify value for the timeout variable. This function is
also called from the I/O queue contexts (nvmf_connect_io_queue()) where 
NVME_IO_TIMEOUT can be used instead of admin timeout.

When timeout is not specified based on the qid set the I/O or Admin
timeout respectively.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 drivers/nvme/host/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 5702a3843746..f4b1df32078e 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -885,7 +885,9 @@ int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
 	if (IS_ERR(req))
 		return PTR_ERR(req);
 
-	req->timeout = timeout ? timeout : ADMIN_TIMEOUT;
+	req->timeout = timeout;
+	if (!req->timeout)
+		req->timeout = qid > 0 ? NVME_IO_TIMEOUT : ADMIN_TIMEOUT;
 
 	if (buffer && bufflen) {
 		ret = blk_rq_map_kern(q, req, buffer, bufflen, GFP_KERNEL);
-- 
2.22.1




More information about the Linux-nvme mailing list