Whamcloud - gitweb
LU-12264 lnet: Protect lp_dc_pendq manipulation with lp_lock
[fs/lustre-release.git] / lnet / lnet / acceptor.c
index 4de013a..9eea92c 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) 2011, 2016, Intel Corporation.
+ * Copyright (c) 2011, 2017, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -152,7 +152,7 @@ int
 lnet_connect(struct socket **sockp, lnet_nid_t peer_nid,
            __u32 local_ip, __u32 peer_ip, int peer_port)
 {
-       lnet_acceptor_connreq_t cr;
+       struct lnet_acceptor_connreq cr;
        struct socket           *sock;
        int                     rc;
        int                     port;
@@ -217,12 +217,12 @@ EXPORT_SYMBOL(lnet_connect);
 static int
 lnet_accept(struct socket *sock, __u32 magic)
 {
-       lnet_acceptor_connreq_t cr;
+       struct lnet_acceptor_connreq cr;
        __u32                   peer_ip;
        int                     peer_port;
        int                     rc;
        int                     flip;
-       lnet_ni_t              *ni;
+       struct lnet_ni *ni;
        char                   *str;
 
        LASSERT(sizeof(cr) <= 16);              /* not too big for the stack */
@@ -299,7 +299,7 @@ lnet_accept(struct socket *sock, __u32 magic)
 
        rc = lnet_sock_read(sock, &cr.acr_nid,
                              sizeof(cr) -
-                             offsetof(lnet_acceptor_connreq_t, acr_nid),
+                             offsetof(struct lnet_acceptor_connreq, acr_nid),
                              accept_timeout);
        if (rc != 0) {
                CERROR("Error %d reading connection request from "
@@ -310,8 +310,8 @@ lnet_accept(struct socket *sock, __u32 magic)
        if (flip)
                __swab64s(&cr.acr_nid);
 
-       ni = lnet_net2ni(LNET_NIDNET(cr.acr_nid));
-       if (ni == NULL ||               /* no matching net */
+       ni = lnet_nid2ni_addref(cr.acr_nid);
+       if (ni == NULL ||               /* no matching net */
            ni->ni_nid != cr.acr_nid) { /* right NET, wrong NID! */
                if (ni != NULL)
                        lnet_ni_decref(ni);
@@ -321,7 +321,7 @@ lnet_accept(struct socket *sock, __u32 magic)
                return -EPERM;
        }
 
-       if (ni->ni_lnd->lnd_accept == NULL) {
+       if (ni->ni_net->net_lnd->lnd_accept == NULL) {
                /* This catches a request for the loopback LND */
                lnet_ni_decref(ni);
                LCONSOLE_ERROR_MSG(0x121, "Refusing connection from %pI4h "
@@ -333,7 +333,7 @@ lnet_accept(struct socket *sock, __u32 magic)
        CDEBUG(D_NET, "Accept %s from %pI4h\n",
               libcfs_nid2str(cr.acr_nid), &peer_ip);
 
-       rc = ni->ni_lnd->lnd_accept(ni, sock);
+       rc = ni->ni_net->net_lnd->lnd_accept(ni, sock);
 
        lnet_ni_decref(ni);
        return rc;
@@ -476,7 +476,7 @@ lnet_acceptor_start(void)
        if (rc <= 0)
                return rc;
 
-       if (lnet_count_acceptor_nis() == 0)  /* not required */
+       if (lnet_count_acceptor_nets() == 0)  /* not required */
                return 0;
 
        task = kthread_run(lnet_acceptor, (void *)(uintptr_t)secure,