Thread (19 messages) 19 messages, 5 authors, 2021-03-15

Re: [PATCH 3/3] nvme: allocate the keep alive request using BLK_MQ_REQ_NOWAIT

From: Hannes Reinecke <hare@suse.de>
Date: 2021-03-04 08:41:15

On 3/3/21 1:53 PM, Christoph Hellwig wrote:
quoted hunk ↗ jump to hunk
To avoid an error recovery deadlock where the keep alive work is waiting
for a request and thus can't be flushed to make progress for tearing down
the controller.  Also print the error code returned from
blk_mq_alloc_request to help debugging any future issues in this code.

Based on an earlier patch from Hannes Reinecke [off-list ref].

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
  drivers/nvme/host/core.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index bdeb3feae61899..8a4a9fe96cdf83 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1241,10 +1241,10 @@ static void nvme_keep_alive_work(struct work_struct *work)
  	}
  
  	rq = nvme_alloc_request(ctrl->admin_q, &ctrl->ka_cmd,
-				BLK_MQ_REQ_RESERVED);
+				BLK_MQ_REQ_RESERVED | BLK_MQ_REQ_NOWAIT);
  	if (IS_ERR(rq)) {
  		/* allocation failure, reset the controller */
-		dev_err(ctrl->device, "keep-alive failed\n");
+		dev_err(ctrl->device, "keep-alive failed: %ld\n", PTR_ERR(rq));
  		nvme_reset_ctrl(ctrl);
  		return;
  	}
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help