Whamcloud - gitweb
Revert "b20288 fix a deadlock in kiblnd_check_conns i=isaac i=maxim"
[fs/lustre-release.git] / lnet / klnds / openiblnd / openiblnd.c
index 73cecc6..1bb72b7 100644 (file)
@@ -1,24 +1,41 @@
 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
- * Copyright (C) 2004 Cluster File Systems, Inc.
- *   Author: Eric Barton <eric@bartonsoftware.com>
+ * GPL HEADER START
  *
- *   This file is part of Lustre, http://www.lustre.org.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
  *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
  *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * 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.
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Use is subject to license terms.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
+ *
+ * lnet/klnds/openiblnd/openiblnd.c
+ *
+ * Author: Eric Barton <eric@bartonsoftware.com>
  */
 
 #include "openiblnd.h"
@@ -72,8 +89,7 @@ kibnal_pack_msg(kib_msg_t *msg, int version, int credits,
         msg->ibm_credits  = credits;
         /*   ibm_nob */
         msg->ibm_cksum    = 0;
-        msg->ibm_srcnid   = lnet_ptlcompat_srcnid(kibnal_data.kib_ni->ni_nid,
-                                                  dstnid);
+        msg->ibm_srcnid   = kibnal_data.kib_ni->ni_nid;
         msg->ibm_srcstamp = kibnal_data.kib_incarnation;
         msg->ibm_dstnid   = dstnid;
         msg->ibm_dststamp = dststamp;
@@ -317,8 +333,7 @@ kibnal_make_svcqry (kib_conn_t *conn)
                 goto out;
         }
         
-        if (!lnet_ptlcompat_matchnid(kibnal_data.kib_ni->ni_nid,
-                                     msg->ibm_dstnid) ||
+        if (kibnal_data.kib_ni->ni_nid != msg->ibm_dstnid ||
             msg->ibm_dststamp != kibnal_data.kib_incarnation) {
                 CERROR("Unexpected dst NID/stamp %s/"LPX64" from "
                        "%s at %u.%u.%u.%u/%d\n", 
@@ -329,7 +344,7 @@ kibnal_make_svcqry (kib_conn_t *conn)
                 goto out;
         }
 
-        if (!lnet_ptlcompat_matchnid(peer->ibp_nid, msg->ibm_srcnid)) {
+        if (peer->ibp_nid != msg->ibm_srcnid) {
                 CERROR("Unexpected src NID %s from %s at %u.%u.%u.%u/%d\n", 
                        libcfs_nid2str(msg->ibm_srcnid),
                        libcfs_nid2str(peer->ibp_nid), 
@@ -383,53 +398,23 @@ kibnal_handle_svcqry (struct socket *sock)
         if (msg->ibm_magic != IBNAL_MSG_MAGIC &&
             msg->ibm_magic != __swab32(IBNAL_MSG_MAGIC)) {
                 /* Unexpected magic! */
-                if (the_lnet.ln_ptlcompat == 0) {
-                        if (msg->ibm_magic == LNET_PROTO_MAGIC ||
-                            msg->ibm_magic == __swab32(LNET_PROTO_MAGIC)) {
-                                /* future protocol version compatibility!
-                                 * When LNET unifies protocols over all LNDs,
-                                 * the first thing sent will be a version
-                                 * query.  I send back a reply in my current
-                                 * protocol to tell her I'm "old" */
-                                kibnal_init_msg(msg, 0, 0);
-                                kibnal_pack_msg(msg, IBNAL_MSG_VERSION, 0, 
-                                                LNET_NID_ANY, 0);
-                                reject = 1;
-                                goto reply;
-                        }
-
-                        CERROR ("Bad magic(1) %#08x (%#08x expected) from "
-                                "%u.%u.%u.%u/%d\n", msg->ibm_magic,
-                                IBNAL_MSG_MAGIC, HIPQUAD(peer_ip), peer_port);
-                        goto out;
-                }
-
-                /* When portals compatibility is set, I may be passed a new
-                 * connection "blindly" by the acceptor, and I have to
-                 * determine if my peer has sent an acceptor connection request
-                 * or not. */
-                rc = lnet_accept(kibnal_data.kib_ni, sock, msg->ibm_magic);
-                if (rc != 0)
-                        goto out;
-
-                /* It was an acceptor connection request!
-                 * Now I should see my magic... */
-                rc = libcfs_sock_read(sock, &msg->ibm_magic,
-                                      sizeof(msg->ibm_magic),
-                                      lnet_acceptor_timeout());
-                if (rc != 0) {
-                        CERROR("Error %d receiving svcqry(2) from %u.%u.%u.%u/%d\n",
-                               rc, HIPQUAD(peer_ip), peer_port);
-                        goto out;
+                if (msg->ibm_magic == LNET_PROTO_MAGIC ||
+                    msg->ibm_magic == __swab32(LNET_PROTO_MAGIC)) {
+                        /* future protocol version compatibility!  When LNET
+                         * unifies protocols over all LNDs, the first thing
+                         * sent will be a version query.  I send back a reply
+                         * in my current protocol to tell her I'm "old" */
+                        kibnal_init_msg(msg, 0, 0);
+                        kibnal_pack_msg(msg, IBNAL_MSG_VERSION, 0, 
+                                        LNET_NID_ANY, 0);
+                        reject = 1;
+                        goto reply;
                 }
 
-                if (msg->ibm_magic != IBNAL_MSG_MAGIC &&
-                    msg->ibm_magic != __swab32(IBNAL_MSG_MAGIC)) {
-                        CERROR ("Bad magic(2) %#08x (%#08x expected) from "
-                                "%u.%u.%u.%u/%d\n", msg->ibm_magic,
-                                IBNAL_MSG_MAGIC, HIPQUAD(peer_ip), peer_port);
-                        goto out;
-                }
+                CERROR ("Bad magic(1) %#08x (%#08x expected) from "
+                        "%u.%u.%u.%u/%d\n", msg->ibm_magic,
+                        IBNAL_MSG_MAGIC, HIPQUAD(peer_ip), peer_port);
+                goto out;
         }
 
         /* Now check version */
@@ -437,7 +422,7 @@ kibnal_handle_svcqry (struct socket *sock)
         rc = libcfs_sock_read(sock, &msg->ibm_version, sizeof(msg->ibm_version),
                               lnet_acceptor_timeout());
         if (rc != 0) {
-                CERROR("Error %d receiving svcqry(3) from %u.%u.%u.%u/%d\n",
+                CERROR("Error %d receiving svcqry(2) from %u.%u.%u.%u/%d\n",
                        rc, HIPQUAD(peer_ip), peer_port);
                 goto out;
         }
@@ -460,7 +445,7 @@ kibnal_handle_svcqry (struct socket *sock)
                               offsetof(kib_msg_t, ibm_type),
                               lnet_acceptor_timeout());
         if (rc != 0) {
-                CERROR("Error %d receiving svcqry(4) from %u.%u.%u.%u/%d\n",
+                CERROR("Error %d receiving svcqry(3) from %u.%u.%u.%u/%d\n",
                        rc, HIPQUAD(peer_ip), peer_port);
                 goto out;
         }
@@ -478,8 +463,7 @@ kibnal_handle_svcqry (struct socket *sock)
                 goto out;
         }
         
-        if (!lnet_ptlcompat_matchnid(kibnal_data.kib_ni->ni_nid,
-                                     msg->ibm_dstnid)) {
+        if (kibnal_data.kib_ni->ni_nid != msg->ibm_dstnid) {
                 CERROR("Unexpected dstnid %s: expected %s from %u.%u.%u.%u/%d\n",
                        libcfs_nid2str(msg->ibm_dstnid),
                        libcfs_nid2str(kibnal_data.kib_ni->ni_nid),
@@ -506,7 +490,6 @@ kibnal_handle_svcqry (struct socket *sock)
                 /* Only complain if we're not rejecting */
                 CERROR("Error %d replying to svcqry from %u.%u.%u.%u/%d\n",
                        rc, HIPQUAD(peer_ip), peer_port);
-                goto out;
         }
         
  out:
@@ -1880,7 +1863,7 @@ kibnal_module_init (void)
         return (0);
 }
 
-MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
+MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
 #ifdef USING_TSAPI
 MODULE_DESCRIPTION("Kernel Cisco IB LND v1.00");
 #else
@@ -1890,4 +1873,3 @@ MODULE_LICENSE("GPL");
 
 module_init(kibnal_module_init);
 module_exit(kibnal_module_fini);
-