From: Tal Shorer Date: Tue, 7 Aug 2018 20:42:39 +0000 (+0300) Subject: nvme-fabrics: fix ctrl_loss_tmo < 0 to reconnect forever X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=66414e80245e1e73222f67ee711951c7f4bdedab;p=linux.git nvme-fabrics: fix ctrl_loss_tmo < 0 to reconnect forever When the user supplies a 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 Reviewed-by: Chaitanya Kulkarni Signed-off-by: Christoph Hellwig --- diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c index 903eb4545e269..3c6cd0f81ba68 100644 --- a/drivers/nvme/host/fabrics.c +++ b/drivers/nvme/host/fabrics.c @@ -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;