Merge branch 'x86-iommu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[cascardo/linux.git] / drivers / staging / lustre / lnet / lnet / acceptor.c
index bb15bde..92c60a7 100644 (file)
@@ -53,6 +53,7 @@ lnet_acceptor_port(void)
 {
        return accept_port;
 }
+EXPORT_SYMBOL(lnet_acceptor_port);
 
 static inline int
 lnet_accept_magic(__u32 magic, __u32 constant)
@@ -61,9 +62,6 @@ lnet_accept_magic(__u32 magic, __u32 constant)
                magic == __swab32(constant));
 }
 
-
-EXPORT_SYMBOL(lnet_acceptor_port);
-
 static char *accept = "secure";
 
 CFS_MODULE_PARM(accept, "s", charp, 0444,
@@ -75,7 +73,7 @@ CFS_MODULE_PARM(accept_backlog, "i", int, 0444,
 CFS_MODULE_PARM(accept_timeout, "i", int, 0644,
                "Acceptor's timeout (seconds)");
 
-static char *accept_type = NULL;
+static char *accept_type;
 
 int
 lnet_acceptor_get_tunables(void)
@@ -95,57 +93,45 @@ lnet_acceptor_timeout(void)
 EXPORT_SYMBOL(lnet_acceptor_timeout);
 
 void
-lnet_connect_console_error (int rc, lnet_nid_t peer_nid,
+lnet_connect_console_error(int rc, lnet_nid_t peer_nid,
                           __u32 peer_ip, int peer_port)
 {
        switch (rc) {
        /* "normal" errors */
        case -ECONNREFUSED:
-               CNETERR("Connection to %s at host %pI4h on port %d was "
-                       "refused: check that Lustre is running on that node.\n",
+               CNETERR("Connection to %s at host %pI4h on port %d was refused: check that Lustre is running on that node.\n",
                        libcfs_nid2str(peer_nid),
                        &peer_ip, peer_port);
                break;
        case -EHOSTUNREACH:
        case -ENETUNREACH:
-               CNETERR("Connection to %s at host %pI4h "
-                       "was unreachable: the network or that node may "
-                       "be down, or Lustre may be misconfigured.\n",
+               CNETERR("Connection to %s at host %pI4h was unreachable: the network or that node may be down, or Lustre may be misconfigured.\n",
                        libcfs_nid2str(peer_nid), &peer_ip);
                break;
        case -ETIMEDOUT:
-               CNETERR("Connection to %s at host %pI4h on "
-                       "port %d took too long: that node may be hung "
-                       "or experiencing high load.\n",
+               CNETERR("Connection to %s at host %pI4h on port %d took too long: that node may be hung or experiencing high load.\n",
                        libcfs_nid2str(peer_nid),
                        &peer_ip, peer_port);
                break;
        case -ECONNRESET:
-               LCONSOLE_ERROR_MSG(0x11b, "Connection to %s at host %pI4h"
-                                  " on port %d was reset: "
-                                  "is it running a compatible version of "
-                                  "Lustre and is %s one of its NIDs?\n",
+               LCONSOLE_ERROR_MSG(0x11b, "Connection to %s at host %pI4h on port %d was reset: is it running a compatible version of Lustre and is %s one of its NIDs?\n",
                                   libcfs_nid2str(peer_nid),
                                   &peer_ip, peer_port,
                                   libcfs_nid2str(peer_nid));
                break;
        case -EPROTO:
-               LCONSOLE_ERROR_MSG(0x11c, "Protocol error connecting to %s at "
-                                  "host %pI4h on port %d: is it running "
-                                  "a compatible version of Lustre?\n",
+               LCONSOLE_ERROR_MSG(0x11c, "Protocol error connecting to %s at host %pI4h on port %d: is it running a compatible version of Lustre?\n",
                                   libcfs_nid2str(peer_nid),
                                   &peer_ip, peer_port);
                break;
        case -EADDRINUSE:
-               LCONSOLE_ERROR_MSG(0x11d, "No privileged ports available to "
-                                  "connect to %s at host %pI4h on port "
-                                  "%d\n", libcfs_nid2str(peer_nid),
+               LCONSOLE_ERROR_MSG(0x11d, "No privileged ports available to connect to %s at host %pI4h on port %d\n",
+                                  libcfs_nid2str(peer_nid),
                                   &peer_ip, peer_port);
                break;
        default:
-               LCONSOLE_ERROR_MSG(0x11e, "Unexpected error %d connecting to %s"
-                                  " at host %pI4h on port %d\n", rc,
-                                  libcfs_nid2str(peer_nid),
+               LCONSOLE_ERROR_MSG(0x11e, "Unexpected error %d connecting to %s at host %pI4h on port %d\n",
+                                  rc, libcfs_nid2str(peer_nid),
                                   &peer_ip, peer_port);
                break;
        }
@@ -162,7 +148,7 @@ lnet_connect(socket_t **sockp, lnet_nid_t peer_nid,
        int                  port;
        int                  fatal;
 
-       CLASSERT (sizeof(cr) <= 16);        /* not too big to be on the stack */
+       CLASSERT(sizeof(cr) <= 16);         /* not too big to be on the stack */
 
        for (port = LNET_ACCEPTOR_MAX_RESERVED_PORT;
             port >= LNET_ACCEPTOR_MIN_RESERVED_PORT;
@@ -178,7 +164,7 @@ lnet_connect(socket_t **sockp, lnet_nid_t peer_nid,
                        continue;
                }
 
-               CLASSERT (LNET_PROTO_ACCEPTOR_VERSION == 1);
+               CLASSERT(LNET_PROTO_ACCEPTOR_VERSION == 1);
 
                cr.acr_magic   = LNET_PROTO_ACCEPTOR_MAGIC;
                cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION;
@@ -232,10 +218,10 @@ lnet_accept(socket_t *sock, __u32 magic)
        lnet_ni_t             *ni;
        char               *str;
 
-       LASSERT (sizeof(cr) <= 16);          /* not too big for the stack */
+       LASSERT(sizeof(cr) <= 16);           /* not too big for the stack */
 
        rc = libcfs_sock_getaddr(sock, 1, &peer_ip, &peer_port);
-       LASSERT (rc == 0);                    /* we succeeded before */
+       LASSERT(rc == 0);                     /* we succeeded before */
 
        if (!lnet_accept_magic(magic, LNET_PROTO_ACCEPTOR_MAGIC)) {
 
@@ -245,15 +231,14 @@ lnet_accept(socket_t *sock, __u32 magic)
                         * thing sent will be a version query.  I send back
                         * LNET_PROTO_ACCEPTOR_MAGIC to tell her I'm "old" */
 
-                       memset (&cr, 0, sizeof(cr));
+                       memset(&cr, 0, sizeof(cr));
                        cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC;
                        cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION;
                        rc = libcfs_sock_write(sock, &cr, sizeof(cr),
                                               accept_timeout);
 
                        if (rc != 0)
-                               CERROR("Error sending magic+version in response"
-                                      "to LNET magic from %pI4h: %d\n",
+                               CERROR("Error sending magic+version in response to LNET magic from %pI4h: %d\n",
                                       &peer_ip, rc);
                        return -EPROTO;
                }
@@ -265,8 +250,7 @@ lnet_accept(socket_t *sock, __u32 magic)
                else
                        str = "unrecognised";
 
-               LCONSOLE_ERROR_MSG(0x11f, "Refusing connection from %pI4h"
-                                  " magic %08x: %s acceptor protocol\n",
+               LCONSOLE_ERROR_MSG(0x11f, "Refusing connection from %pI4h magic %08x: %s acceptor protocol\n",
                                   &peer_ip, magic, str);
                return -EPROTO;
        }
@@ -277,8 +261,8 @@ lnet_accept(socket_t *sock, __u32 magic)
                              sizeof(cr.acr_version),
                              accept_timeout);
        if (rc != 0) {
-               CERROR("Error %d reading connection request version from "
-                      "%pI4h\n", rc, &peer_ip);
+               CERROR("Error %d reading connection request version from %pI4h\n",
+                       rc, &peer_ip);
                return -EIO;
        }
 
@@ -292,7 +276,7 @@ lnet_accept(socket_t *sock, __u32 magic)
                 * "old". */
                int peer_version = cr.acr_version;
 
-               memset (&cr, 0, sizeof(cr));
+               memset(&cr, 0, sizeof(cr));
                cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC;
                cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION;
 
@@ -300,8 +284,7 @@ lnet_accept(socket_t *sock, __u32 magic)
                                       accept_timeout);
 
                if (rc != 0)
-                       CERROR("Error sending magic+version in response"
-                              "to version %d from %pI4h: %d\n",
+                       CERROR("Error sending magic+version in response to version %d from %pI4h: %d\n",
                               peer_version, &peer_ip, rc);
                return -EPROTO;
        }
@@ -311,8 +294,8 @@ lnet_accept(socket_t *sock, __u32 magic)
                              offsetof(lnet_acceptor_connreq_t, acr_nid),
                              accept_timeout);
        if (rc != 0) {
-               CERROR("Error %d reading connection request from "
-                      "%pI4h\n", rc, &peer_ip);
+               CERROR("Error %d reading connection request from %pI4h\n",
+                       rc, &peer_ip);
                return -EIO;
        }
 
@@ -324,8 +307,7 @@ lnet_accept(socket_t *sock, __u32 magic)
            ni->ni_nid != cr.acr_nid) { /* right NET, wrong NID! */
                if (ni != NULL)
                        lnet_ni_decref(ni);
-               LCONSOLE_ERROR_MSG(0x120, "Refusing connection from %pI4h"
-                                  " for %s: No matching NI\n",
+               LCONSOLE_ERROR_MSG(0x120, "Refusing connection from %pI4h for %s: No matching NI\n",
                                   &peer_ip, libcfs_nid2str(cr.acr_nid));
                return -EPERM;
        }
@@ -333,8 +315,7 @@ lnet_accept(socket_t *sock, __u32 magic)
        if (ni->ni_lnd->lnd_accept == NULL) {
                /* This catches a request for the loopback LND */
                lnet_ni_decref(ni);
-               LCONSOLE_ERROR_MSG(0x121, "Refusing connection from %pI4h"
-                                 " for %s: NI doesn not accept IP connections\n",
+               LCONSOLE_ERROR_MSG(0x121, "Refusing connection from %pI4h for %s: NI doesn not accept IP connections\n",
                                  &peer_ip, libcfs_nid2str(cr.acr_nid));
                return -EPERM;
        }
@@ -358,7 +339,7 @@ lnet_acceptor(void *arg)
        int         peer_port;
        int         secure = (int)((long_ptr_t)arg);
 
-       LASSERT (lnet_acceptor_state.pta_sock == NULL);
+       LASSERT(lnet_acceptor_state.pta_sock == NULL);
 
        cfs_block_allsigs();
 
@@ -366,12 +347,10 @@ lnet_acceptor(void *arg)
                                0, accept_port, accept_backlog);
        if (rc != 0) {
                if (rc == -EADDRINUSE)
-                       LCONSOLE_ERROR_MSG(0x122, "Can't start acceptor on port"
-                                          " %d: port already in use\n",
+                       LCONSOLE_ERROR_MSG(0x122, "Can't start acceptor on port %d: port already in use\n",
                                           accept_port);
                else
-                       LCONSOLE_ERROR_MSG(0x123, "Can't start acceptor on port "
-                                          "%d: unexpected error %d\n",
+                       LCONSOLE_ERROR_MSG(0x123, "Can't start acceptor on port %d: unexpected error %d\n",
                                           accept_port, rc);
 
                lnet_acceptor_state.pta_sock = NULL;
@@ -410,8 +389,7 @@ lnet_acceptor(void *arg)
                }
 
                if (secure && peer_port > LNET_ACCEPTOR_MAX_RESERVED_PORT) {
-                       CERROR("Refusing connection from %pI4h: "
-                              "insecure port %d\n",
+                       CERROR("Refusing connection from %pI4h: insecure port %d\n",
                               &peer_ip, peer_port);
                        goto failed;
                }
@@ -419,8 +397,8 @@ lnet_acceptor(void *arg)
                rc = libcfs_sock_read(newsock, &magic, sizeof(magic),
                                      accept_timeout);
                if (rc != 0) {
-                       CERROR("Error %d reading connection request from "
-                              "%pI4h\n", rc, &peer_ip);
+                       CERROR("Error %d reading connection request from %pI4h\n",
+                               rc, &peer_ip);
                        goto failed;
                }
 
@@ -430,7 +408,7 @@ lnet_acceptor(void *arg)
 
                continue;
 
-       failed:
+failed:
                libcfs_sock_release(newsock);
        }
 
@@ -469,7 +447,7 @@ lnet_acceptor_start(void)
        long rc2;
        long secure;
 
-       LASSERT (lnet_acceptor_state.pta_sock == NULL);
+       LASSERT(lnet_acceptor_state.pta_sock == NULL);
 
        rc = lnet_acceptor_get_tunables();
        if (rc != 0)