Whamcloud - gitweb
LU-11514 lnet: separate ni state from recovery
[fs/lustre-release.git] / lnet / lnet / config.c
index 4cdd845..240a27d 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, 2016, Intel Corporation.
+ * Copyright (c) 2012, 2017, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -31,6 +31,8 @@
  */
 
 #define DEBUG_SUBSYSTEM S_LNET
+
+#include <linux/ctype.h>
 #include <linux/nsproxy.h>
 #include <net/net_namespace.h>
 #include <lnet/lib-lnet.h>
@@ -173,7 +175,7 @@ lnet_net_append_cpts(__u32 *cpts, __u32 ncpts, struct lnet_net *net)
                LIBCFS_ALLOC(net->net_cpts, sizeof(*net->net_cpts) * ncpts);
                if (net->net_cpts == NULL)
                        return -ENOMEM;
-               memcpy(net->net_cpts, cpts, ncpts);
+               memcpy(net->net_cpts, cpts, ncpts * sizeof(*net->net_cpts));
                net->net_ncpts = ncpts;
                return 0;
        }
@@ -454,8 +456,8 @@ lnet_ni_alloc_common(struct lnet_net *net, char *iface)
        }
 
        spin_lock_init(&ni->ni_lock);
-       INIT_LIST_HEAD(&ni->ni_cptlist);
        INIT_LIST_HEAD(&ni->ni_netlist);
+       INIT_LIST_HEAD(&ni->ni_recovery);
        ni->ni_refs = cfs_percpt_alloc(lnet_cpt_table(),
                                       sizeof(*ni->ni_refs[0]));
        if (ni->ni_refs == NULL)