nvme-fabrics: fix ctrl_loss_tmo < 0 to reconnect forever
authorTal Shorer <tal.shorer@gmail.com>
Tue, 7 Aug 2018 20:42:39 +0000 (23:42 +0300)
committerChristoph Hellwig <hch@lst.de>
Wed, 8 Aug 2018 10:01:49 +0000 (12:01 +0200)
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 <tal.shorer@gmail.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/fabrics.c

index 903eb4545e2699bc1b62365e5ca4490e824a8c5c..3c6cd0f81ba6849dd57325c6f7301118c754afd5 100644 (file)
@@ -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;