Whamcloud - gitweb
b=16098
[fs/lustre-release.git] / lnet / klnds / ralnd / ralnd.c
index a0a4d93..0344f13 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  2008 Sun Microsystems, Inc. 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/ralnd/ralnd.c
+ *
+ * Author: Eric Barton <eric@bartonsoftware.com>
  */
 #include "ralnd.h"
 
@@ -52,8 +69,7 @@ kranal_pack_connreq(kra_connreq_t *connreq, kra_conn_t *conn, lnet_nid_t dstnid)
                 return;
 
         connreq->racr_devid     = conn->rac_device->rad_id;
-        connreq->racr_srcnid    = lnet_ptlcompat_srcnid(kranal_data.kra_ni->ni_nid,
-                                                        dstnid);
+        connreq->racr_srcnid    = kranal_data.kra_ni->ni_nid;
         connreq->racr_dstnid    = dstnid;
         connreq->racr_peerstamp = kranal_data.kra_peerstamp;
         connreq->racr_connstamp = conn->rac_my_connstamp;
@@ -84,7 +100,6 @@ kranal_recv_connreq(struct socket *sock, kra_connreq_t *connreq, int active)
             connreq->racr_magic != __swab32(RANAL_MSG_MAGIC)) {
                 /* Unexpected magic! */
                 if (!active &&
-                    the_lnet.ln_ptlcompat == 0 &&
                     (connreq->racr_magic == LNET_PROTO_MAGIC ||
                      connreq->racr_magic == __swab32(LNET_PROTO_MAGIC))) {
                         /* future protocol version compatibility!
@@ -94,36 +109,9 @@ kranal_recv_connreq(struct socket *sock, kra_connreq_t *connreq, int active)
                         return EPROTO;
                 }
 
-                if (active ||
-                    the_lnet.ln_ptlcompat == 0) {
-                        CERROR("Unexpected magic %08x (1)\n",
-                               connreq->racr_magic);
-                        return -EPROTO;
-                }
-
-                /* 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.  This isn't a connreq, so I'll get the acceptor to
-                 * look at it... */
-                rc = lnet_accept(kranal_data.kra_ni, sock, connreq->racr_magic);
-                if (rc != 0)
-                        return -EPROTO;
-
-                /* ...and if it's OK I'm back to looking for a connreq... */
-                rc = libcfs_sock_read(sock, &connreq->racr_magic,
-                                      sizeof(connreq->racr_magic), timeout);
-                if (rc != 0) {
-                        CERROR("Read(magic) failed(2): %d\n", rc);
-                        return -EIO;
-                }
-
-                if (connreq->racr_magic != RANAL_MSG_MAGIC &&
-                    connreq->racr_magic != __swab32(RANAL_MSG_MAGIC)) {
-                        CERROR("Unexpected magic %08x(2)\n",
-                               connreq->racr_magic);
-                        return -EPROTO;
-                }
+                CERROR("Unexpected magic %08x (%s)\n",
+                       connreq->racr_magic, active ? "active" : "passive");
+                return -EPROTO;
         }
 
         swab = (connreq->racr_magic == __swab32(RANAL_MSG_MAGIC));
@@ -728,7 +716,7 @@ kranal_conn_handshake (struct socket *sock, kra_peer_t *peer)
         /* Refuse connection if peer thinks we are a different NID.  We check
          * this while holding the global lock, to synch with connection
          * destruction on NID change. */
-        if (!lnet_ptlcompat_matchnid(kranal_data.kra_ni->ni_nid, dst_nid)) {
+        if (kranal_data.kra_ni->ni_nid != dst_nid) {
                 write_unlock_irqrestore(&kranal_data.kra_global_lock, flags);
 
                 CERROR("Stale/bad connection with %s: dst_nid %s, expected %s\n",
@@ -1733,7 +1721,7 @@ kranal_module_init (void)
         return 0;
 }
 
-MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
+MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
 MODULE_DESCRIPTION("Kernel RapidArray LND v0.01");
 MODULE_LICENSE("GPL");