[PATCH libnvme 3/1] fabrics: add notify_rediscover parameter

Sagi Grimberg sagi at grimberg.me
Wed Sep 7 07:24:10 PDT 2022


When a discovery controller is disconnected, no AENs will
arrive to notify the host about discovery log-page changes.

In order to solve this, add a notify_rediscover parameter
that we can pass the kernel to notify us via uevent when
a discovery controller reconnect.

Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
---
 src/nvme/fabrics.c | 3 +++
 src/nvme/fabrics.h | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/src/nvme/fabrics.c b/src/nvme/fabrics.c
index 678ca2af2561..b49bc2eda965 100644
--- a/src/nvme/fabrics.c
+++ b/src/nvme/fabrics.c
@@ -214,6 +214,7 @@ static struct nvme_fabrics_config *merge_config(nvme_ctrl_t c,
 	MERGE_CFG_OPTION(ctrl_cfg, cfg, hdr_digest, false);
 	MERGE_CFG_OPTION(ctrl_cfg, cfg, data_digest, false);
 	MERGE_CFG_OPTION(ctrl_cfg, cfg, tls, false);
+	MERGE_CFG_OPTION(ctrl_cfg, cfg, notify_rediscover, false);
 
 	return ctrl_cfg;
 }
@@ -481,6 +482,8 @@ static int build_options(nvme_host_t h, nvme_ctrl_t c, char **argstr)
 	    (hostid && add_argument(argstr, "hostid", hostid)) ||
 	    (discover && !discovery_nqn &&
 	     add_bool_argument(argstr, "discovery", true)) ||
+	     add_bool_argument(argstr, "notify_rediscover",
+			       cfg->notify_rediscover) ||
 	    (!discover && hostkey &&
 	     add_argument(argstr, "dhchap_secret", hostkey)) ||
 	    (!discover && ctrlkey &&
diff --git a/src/nvme/fabrics.h b/src/nvme/fabrics.h
index 83353a65c5d7..377475a690f6 100644
--- a/src/nvme/fabrics.h
+++ b/src/nvme/fabrics.h
@@ -40,6 +40,7 @@
  * @hdr_digest:		Generate/verify header digest (TCP)
  * @data_digest:	Generate/verify data digest (TCP)
  * @tls:		Start TLS on the connection (TCP)
+ * @notify_rediscover:  Send uevent notification for rediscovery upon reconnect
  */
 struct nvme_fabrics_config {
 	char *host_traddr;
@@ -59,6 +60,7 @@ struct nvme_fabrics_config {
 	bool hdr_digest;
 	bool data_digest;
 	bool tls;
+	bool notify_rediscover;
 };
 
 /**
-- 
2.34.1




More information about the Linux-nvme mailing list