[PATCH nvme-cli] fabrics: fix passing ctrl_loss_tmo=0 by default

Sagi Grimberg sagi at grimberg.me
Wed Aug 19 23:13:20 EDT 2020


cfg.ctrl_loss_tmo will be cleared to zero even if it wasn't set
at all, we must not pass ctrl_loss_tmo in the connection string.

This fixes a regression caused by allowing ctrl_loss_tmo to be
zero at all, by setting it to be a sane default (which currently
matches the kernel default).

Fixes: a6105a30a39a ("nvme-cli/fabrics: Add tos param to connect cmd")
Fixes: 4b607779af71 ("Allow 0 value of ctrl_loss_tmo.")
Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
---
 fabrics.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fabrics.c b/fabrics.c
index c93b752ff142..f8a055b7d9ba 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -54,6 +54,9 @@
 
 #define NVMF_HOSTID_SIZE	36
 
+/* default to 600 seconds of reconnect attempts before giving up */
+#define NVMF_DEF_CTRL_LOSS_TMO		600
+
 const char *conarg_nqn = "nqn";
 const char *conarg_transport = "transport";
 const char *conarg_traddr = "traddr";
@@ -85,7 +88,7 @@ static struct config {
 	bool persistent;
 	bool quiet;
 	bool matching_only;
-} cfg = { NULL };
+} cfg = { .ctrl_loss_tmo = NVMF_DEF_CTRL_LOSS_TMO };
 
 struct connect_args {
 	char *subsysnqn;
-- 
2.25.1




More information about the Linux-nvme mailing list