From 195607dcb5c650c087d6d378c70aa5eb85d97cde Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Fri, 8 Apr 2022 14:08:47 +0200 Subject: [PATCH] fabrics: Set KATO for discovery controller when connecting In case we are connecting to the discovered controllers we should also set the KATO value for persistent discocovery controllers correctly. Unfortunatly, the compiler seems to get confused by only conditionally setting tmo and warns about uninitialized variable. Hence we always store and restore keep_alive_tmo. Signed-off-by: Daniel Wagner --- fabrics.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fabrics.c b/fabrics.c index 71e15bc1..fa984654 100644 --- a/fabrics.c +++ b/fabrics.c @@ -288,7 +288,7 @@ static void json_connect_msg(nvme_ctrl_t c) json_free_object(root); } -static int __discover(nvme_ctrl_t c, const struct nvme_fabrics_config *defcfg, +static int __discover(nvme_ctrl_t c, struct nvme_fabrics_config *defcfg, char *raw, bool connect, bool persistent, enum nvme_print_flags flags) { @@ -324,10 +324,17 @@ static int __discover(nvme_ctrl_t c, const struct nvme_fabrics_config *defcfg, struct nvmf_disc_log_entry *e = &log->entries[i]; bool discover = false; nvme_ctrl_t child; + int tmo = defcfg->keep_alive_tmo; + + if (e->subtype == NVME_NQN_DISC) + set_discovery_kato(defcfg); errno = 0; child = nvmf_connect_disc_entry(h, e, defcfg, &discover); + + defcfg->keep_alive_tmo = tmo; + if (child) { if (discover) __discover(child, defcfg, raw, -- 2.50.1