Whamcloud - gitweb
LU-9679 lnet: discard lnet_print_text_bufs()
[fs/lustre-release.git] / lnet / lnet / config.c
index 7af6ced..e375cd6 100644 (file)
@@ -381,7 +381,6 @@ lnet_net_alloc(__u32 net_id, struct list_head *net_list)
 
        net->net_id = net_id;
        net->net_last_alive = ktime_get_real_seconds();
-       net->net_state = LNET_NET_STATE_INIT;
 
        /* initialize global paramters to undefiend */
        net->net_tunables.lct_peer_timeout = -1;
@@ -480,10 +479,10 @@ lnet_ni_alloc_common(struct lnet_net *net, char *iface)
        ni->ni_nid = LNET_MKNID(net->net_id, 0);
 
        /* Store net namespace in which current ni is being created */
-       if (current->nsproxy->net_ns != NULL)
+       if (current->nsproxy && current->nsproxy->net_ns)
                ni->ni_net_ns = get_net(current->nsproxy->net_ns);
        else
-               ni->ni_net_ns = NULL;
+               ni->ni_net_ns = get_net(&init_net);
 
        ni->ni_state = LNET_NI_STATE_INIT;
        list_add_tail(&ni->ni_netlist, &net->net_ni_added);
@@ -902,21 +901,6 @@ lnet_free_text_bufs(struct list_head *tbs)
        }
 }
 
-void
-lnet_print_text_bufs(struct list_head *tbs)
-{
-       struct list_head *tmp;
-       struct lnet_text_buf  *ltb;
-
-       list_for_each(tmp, tbs) {
-               ltb = list_entry(tmp, struct lnet_text_buf, ltb_list);
-
-               CDEBUG(D_WARNING, "%s\n", ltb->ltb_text);
-       }
-
-       CDEBUG(D_WARNING, "%d allocated\n", lnet_tbnob);
-}
-
 static int
 lnet_str2tbs_sep(struct list_head *tbs, char *str)
 {
@@ -1313,7 +1297,7 @@ lnet_parse_routes (char *routes, int *im_a_router)
 static int
 lnet_match_network_token(char *token, int len, __u32 *ipaddrs, int nip)
 {
-       struct list_head list = LIST_HEAD_INIT(list);
+       LIST_HEAD(list);
        int             rc;
        int             i;
 
@@ -1575,12 +1559,11 @@ lnet_match_networks (char **networksp, char *ip2nets, __u32 *ipaddrs, int nip)
                list_for_each_safe(t, t2, &current_nets) {
                        tb = list_entry(t, struct lnet_text_buf, ltb_list);
 
-                       list_del(&tb->ltb_list);
-                       list_add_tail(&tb->ltb_list, &matched_nets);
+                       list_move_tail(&tb->ltb_list, &matched_nets);
 
-                       len += snprintf(networks + len, sizeof(networks) - len,
-                                       "%s%s", (len == 0) ? "" : ",",
-                                       tb->ltb_text);
+                       len += scnprintf(networks + len, sizeof(networks) - len,
+                                        "%s%s", (len == 0) ? "" : ",",
+                                        tb->ltb_text);
 
                        if (len >= sizeof(networks)) {
                                CERROR("Too many matched networks\n");
@@ -1700,7 +1683,10 @@ lnet_parse_ip2nets (char **networksp, char *ip2nets)
        int        rc;
        int i;
 
-       nip = lnet_inet_enumerate(&ifaces, current->nsproxy->net_ns);
+       if (current->nsproxy && current->nsproxy->net_ns)
+               nip = lnet_inet_enumerate(&ifaces, current->nsproxy->net_ns);
+       else
+               nip = lnet_inet_enumerate(&ifaces, &init_net);
        if (nip < 0) {
                if (nip != -ENOENT) {
                        LCONSOLE_ERROR_MSG(0x117,