Whamcloud - gitweb
LU-18063 lnet: restore LNet NI dropped information 75/55975/5
authorJames Simmons <jsimmons@infradead.org>
Thu, 8 Aug 2024 18:48:11 +0000 (12:48 -0600)
committerOleg Drokin <green@whamcloud.com>
Fri, 23 Aug 2024 22:03:19 +0000 (22:03 +0000)
In testing setting up 2 different LNet nets, tcp1 and tcp2,
revealed two bugs.

The first network was setup using the interface and defaults
to the specified net (tcp1) and the second was setup with a
specific NID (xxx@tcp2). In the case of setup with a specific
NID no interface was provided and it was not found. This was
due to checking only for NULL interface names. Adding checks
for zero length strings also ensures an interface will always
be set for NI.

The next bug observed was the loss of lnd tunable information
with multiple LNet nets. This information is contained in
struct lnet_lnd for each specific LND driver. In the current
code while looping over all the nets we check if the struct
lnet_lnd has changed. It was clearing the local lnd pointer
on no change to avoid sending the same key table multiple
times. We want to only send a new key table if the lnet_lnd
has changed. Later in the inner loop we use the same
struct lnet_lnd to enquire about LND specific information but
since it was set to NULL earlier we can't collect this data.
Introduce a flag instead to avoid sending the key table and
keep around the lnd for data collection.

Test-Parameters: trivial testlist=sanity-lnet
Fixes: d15bfca078 ("LU-10391 lnet: migrate full LNet NI information collection")
Fixes: fff650726b ("LU-13642 lnet: Allow dynamic IP specification")
Change-Id: Ibeb908b106ff0331e1c09249811b3a8a2d7f345e
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55975
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: Cyril Bordage <cbordage@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lnet/klnds/gnilnd/gnilnd.c
lnet/klnds/o2iblnd/o2iblnd.c
lnet/klnds/socklnd/socklnd.c
lnet/lnet/api-ni.c
lnet/lnet/config.c
lustre/tests/sanity-lnet.sh

index 3695176..ef2a024 100644 (file)
@@ -2644,7 +2644,7 @@ kgnilnd_startup(struct lnet_ni *ni)
 
        kgnilnd_tunables_setup(ni);
 
-       if (!ni->ni_interface) {
+       if (!ni->ni_interface || !strlen(ni->ni_interface)) {
                rc = lnet_ni_add_interface(ni, "ipogif0");
                if (rc < 0)
                        CWARN("gnilnd failed to allocate ni_interface\n");
index 7f1faf8..1b130ca 100644 (file)
@@ -3838,7 +3838,7 @@ kiblnd_startup(struct lnet_ni *ni)
        }
 
        net->ibn_dev = ibdev;
-       if (!ni->ni_interface) {
+       if (!ni->ni_interface || !strlen(ni->ni_interface)) {
                rc = lnet_ni_add_interface(ni, ifaces[i].li_name);
                if (rc < 0)
                        CWARN("ko2iblnd failed to allocate ni_interface\n");
index 8ed664f..0d3bda0 100644 (file)
@@ -2652,7 +2652,7 @@ ksocknal_startup(struct lnet_ni *ni)
        if (if_idx < 0)
                goto out_net;
 
-       if (!ni->ni_interface) {
+       if (!ni->ni_interface || !strlen(ni->ni_interface)) {
                rc = lnet_ni_add_interface(ni, ifaces[if_idx].li_name);
                if (rc < 0)
                        CWARN("ksocklnd failed to allocate ni_interface\n");
index d6075a5..d1fce1b 100644 (file)
@@ -5576,6 +5576,7 @@ static int lnet_net_show_dump(struct sk_buff *msg,
 
        list_for_each_entry(net, &the_lnet.ln_nets, net_list) {
                struct nlattr *local_ni, *ni_attr;
+               bool send_lnd_keys = false;
                struct lnet_ni *ni;
                int dev = 0;
 
@@ -5592,16 +5593,16 @@ static int lnet_net_show_dump(struct sk_buff *msg,
                                               "LND not setup for NI");
                                GOTO(net_unlock, rc = -ENODEV);
                        }
-                       if (net->net_lnd != lnd)
+                       if (net->net_lnd != lnd) {
+                               send_lnd_keys = true;
                                lnd = net->net_lnd;
-                       else
-                               lnd = NULL;
+                       }
                }
 
                /* We need to resend the key table every time the base LND
                 * changed.
                 */
-               if (!idx || lnd) {
+               if (!idx || send_lnd_keys) {
                        const struct ln_key_list *all[] = {
                                &net_props_list, &local_ni_list,
                                &local_ni_interfaces_list,
index 3c52d46..2c60a74 100644 (file)
@@ -365,7 +365,10 @@ int lnet_ni_add_interface(struct lnet_ni *ni, char *iface)
        if (ni == NULL)
                return -ENOMEM;
 
-       if (ni->ni_interface != NULL) {
+       if (!iface || !strlen(iface))
+               return -EINVAL;
+
+       if (ni->ni_interface && strlen(ni->ni_interface)) {
                LCONSOLE_ERROR("%s: interface %s already set for net %s: rc = %d\n",
                               iface, ni->ni_interface,
                               libcfs_net2str(LNET_NID_NET(&ni->ni_nid)),
@@ -452,7 +455,7 @@ lnet_ni_alloc_common(struct lnet_net *net, struct lnet_nid *nid, char *iface)
         * if an interface name is provided then make sure to add in that
         * interface name in NI
         */
-       if (iface)
+       if (iface && strlen(iface))
                if (lnet_ni_add_interface(ni, iface) != 0)
                        goto failed;
 
index 5a203db..6f00628 100755 (executable)
@@ -1794,6 +1794,24 @@ test_111() {
 }
 run_test 111 "Test many routes"
 
+test_112() {
+       cleanup_lnet || error "Failed to unload modules before test execution"
+
+       setup_fakeif || error "Failed to add fake IF"
+
+       reinit_dlc || return $?
+
+       $LNETCTL net add --net tcp1 --if ${INTERFACES[0]}
+       $LNETCTL net add --nid ${FAKE_IP}@tcp2
+
+       local count=$($LNETCTL net show -v 3 2>/dev/null | grep -c "lnd tunables:")
+       (( count == 2 )) || error "missing lnd tunables"
+
+       cleanup_lnet
+       cleanup_fakeif
+}
+run_test 112 "multiple net configurations"
+
 test_199() {
        [[ ${NETTYPE} == tcp* || ${NETTYPE} == o2ib* ]] ||
                skip "Need tcp or o2ib NETTYPE"