Skip to contentSkip to conversation

nvme: fabrics: fix ctrl_loss_tmo < 0 to reconnect forever

PATCH Applied Tal Shorer 3 participants 3 messages Aug 7, 2018 – Aug 8, 2018 NVMe

lore
Share & tools
lore

Tal Shorer

author
#0 lore raw

PATCH 1/1 nvme: fabrics: fix ctrl_loss_tmo < 0 to reconnect forever

When the user supplics ctrl_loss_tmo < 0, we warn them that this will cause the fabrics layer to attempt reconnection forever. However, in reality the fabrics layer never attempts to reconnect because the condition to test whether we should reconnect is backwards in this case.

Signed-off-by Tal Shorer <tal.shorer at gmail.com>
---
 drivers/nvme/host/fabrics.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/fabrics.c +1 -1
index f7efe5a58cc7..206d63cb1afc 100644
@@ -474,7 +474,7 @@ EXPORT_SYMBOL_GPL(nvmf_connect_io_queue);
 
 bool nvmf_should_reconnect(struct nvme_ctrl *ctrl)
 {
-	if (ctrl->opts->max_reconnects != -1 &&
+	if (ctrl->opts->max_reconnects == -1 ||
 	    ctrl->nr_reconnects < ctrl->opts->max_reconnects)
 		return true;
 
Signature · 1 line
2.14.1
Reviewed-by on v1 1/1
#1 lore raw

Looks good to me.

Just 's/supplics/supplies/'.

Without looking into the entire code, If we can change the type of max_reconnect and nr_reconnects to unsigned int then we can just get away with the one comparison (ctrl->nr_reconnects < ctrl->opts->max_reconnects).

Reviewed-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>

From: Linux-nvme <[email protected]> on behalf of Tal Shorer <[email protected]>
Sent: Tuesday, August 7, 2018 1:42 PM
To: keith.busch at intel.com; axboe at fb.com; hch at lst.de; sagi at grimberg.me; linux-nvme at lists.infradead.org; linux-kernel at vger.kernel.org
Cc: Tal Shorer
Subject: [PATCH] nvme: fabrics: fix ctrl_loss_tmo < 0 to reconnect forever
?

When the user supplics ctrl_loss_tmo < 0, we warn them that this will cause the fabrics layer to attempt reconnection forever. However, in reality the fabrics layer never attempts to reconnect because the condition to test whether we should reconnect is backwards in this case.

Signed-off-by Tal Shorer <tal.shorer at gmail.com>

---
?drivers/nvme/host/fabrics.c | 2 +-
?1 file changed, 1 insertion(+), 1 deletion(-)

drivers/nvme/host/fabrics.c +0 -0
index f7efe5a58cc7..206d63cb1afc 100644
@@ -474,7 +474,7 @@ EXPORT_SYMBOL_GPL(nvmf_connect_io_queue);

?
?bool nvmf_should_reconnect(struct nvme_ctrl *ctrl) ?{
-?????? if (ctrl->opts->max_reconnects != -1 && +?????? if (ctrl->opts->max_reconnects == -1 || ???????????? ctrl->nr_reconnects < ctrl->opts->max_reconnects) ???????????????? return true;
?

Signature · 7 lines
2.14.1


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