Whamcloud - gitweb
LU-8891 llite: rcu-walk check should not depend on statahead
[fs/lustre-release.git] / lnet / lnet / lib-socket.c
index 70b9ee2..4eaaf6c 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -27,7 +23,7 @@
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, 2014, Intel Corporation.
+ * Copyright (c) 2015, 2016, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -68,7 +64,11 @@ lnet_sock_ioctl(int cmd, unsigned long arg)
        int             fd = -1;
        int             rc;
 
-       rc = sock_create(PF_INET, SOCK_STREAM, 0, &sock);
+#ifdef HAVE_SOCK_CREATE_KERN_USE_NET
+       rc = sock_create_kern(&init_net, PF_INET, SOCK_STREAM, 0, &sock);
+#else
+       rc = sock_create_kern(PF_INET, SOCK_STREAM, 0, &sock);
+#endif
        if (rc != 0) {
                CERROR("Can't create socket: %d\n", rc);
                return rc;
@@ -202,9 +202,9 @@ lnet_ipif_enumerate(char ***namesp)
        nalloc = 16;    /* first guess at max interfaces */
        toobig = 0;
        for (;;) {
-               if (nalloc * sizeof(*ifr) > PAGE_CACHE_SIZE) {
+               if (nalloc * sizeof(*ifr) > PAGE_SIZE) {
                        toobig = 1;
-                       nalloc = PAGE_CACHE_SIZE/sizeof(*ifr);
+                       nalloc = PAGE_SIZE / sizeof(*ifr);
                        CWARN("Too many interfaces: only enumerating "
                              "first %d\n", nalloc);
                }
@@ -417,7 +417,11 @@ lnet_sock_create(struct socket **sockp, int *fatal,
        /* All errors are fatal except bind failure if the port is in use */
        *fatal = 1;
 
-       rc = sock_create(PF_INET, SOCK_STREAM, 0, &sock);
+#ifdef HAVE_SOCK_CREATE_KERN_USE_NET
+       rc = sock_create_kern(&init_net, PF_INET, SOCK_STREAM, 0, &sock);
+#else
+       rc = sock_create_kern(PF_INET, SOCK_STREAM, 0, &sock);
+#endif
        *sockp = sock;
        if (rc != 0) {
                CERROR("Can't create socket: %d\n", rc);
@@ -554,6 +558,13 @@ lnet_sock_listen(struct socket **sockp,
        return rc;
 }
 
+#ifndef HAVE_SK_SLEEP
+static inline wait_queue_head_t *sk_sleep(struct sock *sk)
+{
+       return sk->sk_sleep;
+}
+#endif
+
 int
 lnet_sock_accept(struct socket **newsockp, struct socket *sock)
 {