Whamcloud - gitweb
This is a debugging patch from LLNL for a rare list walking issue.
[fs/lustre-release.git] / lnet / lnet / config.c
index cd5e211..ecf6206 100644 (file)
@@ -1,22 +1,37 @@
 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
- *  Copyright (c) 2005 Cluster File Systems, Inc.
+ * GPL HEADER START
  *
- *   This file is part of Lustre, http://www.sf.net/projects/lustre/
+ * 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.
  */
 
 #define DEBUG_SUBSYSTEM S_LNET
@@ -52,10 +67,10 @@ lnet_syntax(char *name, char *str, int offset, int width)
         memset(dashes, '-', sizeof(dashes));
         dashes[sizeof(dashes)-1] = 0;
         
-       LCONSOLE_ERROR("Error parsing '%s=\"%s\"'\n", name, str);
-       LCONSOLE_ERROR("here...........%.*s..%.*s|%.*s|\n", 
-                       (int)strlen(name), dots, offset, dots,
-                       (width < 1) ? 0 : width - 1, dashes);
+       LCONSOLE_ERROR_MSG(0x10f, "Error parsing '%s=\"%s\"'\n", name, str);
+       LCONSOLE_ERROR_MSG(0x110, "here...........%.*s..%.*s|%.*s|\n", 
+                           (int)strlen(name), dots, offset, dots,
+                            (width < 1) ? 0 : width - 1, dashes);
 }
 
 int 
@@ -126,8 +141,8 @@ lnet_new_ni(__u32 net, struct list_head *nilist)
         lnet_ni_t *ni;
 
         if (!lnet_net_unique(net, nilist)) {
-                LCONSOLE_ERROR("Duplicate network specified: %s\n",
-                               libcfs_net2str(net));
+                LCONSOLE_ERROR_MSG(0x111, "Duplicate network specified: %s\n",
+                                   libcfs_net2str(net));
                 return NULL;
         }
         
@@ -161,7 +176,8 @@ lnet_parse_networks(struct list_head *nilist, char *networks)
 
        if (strlen(networks) > LNET_SINGLE_TEXTBUF_NOB) {
                /* _WAY_ conservative */
-               LCONSOLE_ERROR("Can't parse networks: string too long\n");
+               LCONSOLE_ERROR_MSG(0x112, "Can't parse networks: string too "
+                                   "long\n");
                return -EINVAL;
        }
 
@@ -202,7 +218,8 @@ lnet_parse_networks(struct list_head *nilist, char *networks)
                        if (net == LNET_NIDNET(LNET_NID_ANY)) {
                                 lnet_syntax("networks", networks, 
                                             str - tokens, strlen(str));
-                                LCONSOLE_ERROR("Unrecognised network type\n");
+                                LCONSOLE_ERROR_MSG(0x113, "Unrecognised network"
+                                                   " type\n");
                                 goto failed;
                         }
 
@@ -222,13 +239,6 @@ lnet_parse_networks(struct list_head *nilist, char *networks)
                         goto failed;
                 } 
 
-                if (nnets > 0 &&
-                    the_lnet.ln_ptlcompat > 0) {
-                        LCONSOLE_ERROR("Only 1 network supported when "
-                                       "'portals_compatible' is set\n");
-                        goto failed;
-                }
-
                 nnets++;
                 ni = lnet_new_ni(net, nilist);
                 if (ni == NULL)
@@ -258,8 +268,9 @@ lnet_parse_networks(struct list_head *nilist, char *networks)
                         }
 
                         if (niface == LNET_MAX_INTERFACES) {
-                                LCONSOLE_ERROR("Too many interfaces for net %s\n",
-                                               libcfs_net2str(net));
+                                LCONSOLE_ERROR_MSG(0x115, "Too many interfaces "
+                                                   "for net %s\n",
+                                                   libcfs_net2str(net));
                                 goto failed;
                         }
 
@@ -378,7 +389,7 @@ lnet_str2tbs_sep (struct list_head *tbs, char *str)
         int               i;
        lnet_text_buf_t  *ltb;
 
-       INIT_LIST_HEAD(&pending);
+       CFS_INIT_LIST_HEAD(&pending);
 
        /* Split 'str' into separate commands */
        for (;;) {
@@ -468,7 +479,7 @@ lnet_str2tbs_expand (struct list_head *tbs, char *str)
        int               nob;
        int               scanned;
 
-       INIT_LIST_HEAD(&pending);
+       CFS_INIT_LIST_HEAD(&pending);
        
        sep = strchr(str, '[');
        if (sep == NULL)                        /* nothing to expand */
@@ -710,14 +721,6 @@ lnet_parse_routes (char *routes, int *im_a_router)
 
         *im_a_router = 0;
 
-        if (the_lnet.ln_ptlcompat > 0 && 
-            routes[0] != 0) {
-                /* Can't route when running in compatibility mode */
-                LCONSOLE_ERROR("Route tables are not supported when "
-                               "'portals_compatible' is set\n");
-                return -EINVAL;
-        }
-        
        CFS_INIT_LIST_HEAD(&tbs);
 
        if (lnet_str2tbs_sep(&tbs, routes) < 0) {
@@ -1276,14 +1279,14 @@ lnet_parse_ip2nets (char **networksp, char *ip2nets)
         int        rc;
 
         if (nip < 0) {
-                LCONSOLE_ERROR("Error %d enumerating local IP interfaces "
-                               "for ip2nets to match\n", nip);
+                LCONSOLE_ERROR_MSG(0x117, "Error %d enumerating local IP "
+                                   "interfaces for ip2nets to match\n", nip);
                 return nip;
         }
 
         if (nip == 0) {
-                LCONSOLE_ERROR("No local IP interfaces "
-                               "for ip2nets to match\n");
+                LCONSOLE_ERROR_MSG(0x118, "No local IP interfaces "
+                                   "for ip2nets to match\n");
                 return -ENOENT;
         }
 
@@ -1291,13 +1294,13 @@ lnet_parse_ip2nets (char **networksp, char *ip2nets)
         lnet_ipaddr_free_enumeration(ipaddrs, nip);
 
         if (rc < 0) {
-                LCONSOLE_ERROR("Error %d parsing ip2nets\n", rc);
+                LCONSOLE_ERROR_MSG(0x119, "Error %d parsing ip2nets\n", rc);
                 return rc;
         }
 
         if (rc == 0) {
-                LCONSOLE_ERROR("ip2nets does not match "
-                               "any local IP interfaces\n");
+                LCONSOLE_ERROR_MSG(0x11a, "ip2nets does not match "
+                                   "any local IP interfaces\n");
                 return -ENOENT;
         }