It also includes code fixes for first five improved error messages.
b=10595
i=adilger
i=braam
#endif /* !__KERNEL__ */
+/*
+ * Lustre Error Checksum: calculates checksum
+ * of Hex number by XORing each bit.
+ */
+#define LERRCHKSUM(hexnum) (((hexnum) & 0xf) ^ ((hexnum) >> 4 & 0xf) ^ \
+ ((hexnum) >> 8 & 0xf))
+
#define CWARN(format, a...) CDEBUG_LIMIT(D_WARNING, format, ## a)
#define CERROR(format, a...) CDEBUG_LIMIT(D_ERROR, format, ## a)
#define CEMERG(format, a...) CDEBUG_LIMIT(D_EMERG, format, ## a)
#define LCONSOLE(mask, format, a...) CDEBUG(D_CONSOLE | (mask), format, ## a)
#define LCONSOLE_INFO(format, a...) CDEBUG_LIMIT(D_CONSOLE, format, ## a)
#define LCONSOLE_WARN(format, a...) CDEBUG_LIMIT(D_CONSOLE | D_WARNING, format, ## a)
-#define LCONSOLE_ERROR(format, a...) CDEBUG_LIMIT(D_CONSOLE | D_ERROR, format, ## a)
+#define LCONSOLE_ERROR(errnum, format, a...) CDEBUG_LIMIT(D_CONSOLE | D_ERROR, \
+ "%x-%x: " format, errnum, LERRCHKSUM(errnum), ## a)
#define LCONSOLE_EMERG(format, a...) CDEBUG(D_CONSOLE | D_EMERG, format, ## a)
#ifdef CDEBUG_ENABLED
int rc;
if (the_lnet.ln_ptlcompat != 0) {
- LCONSOLE_ERROR("IIB does not support portals compatibility mode\n");
+ LCONSOLE_ERROR(0x12c, "IIB does not support portals compatibility mode\n");
return -ENODEV;
}
if (conn->ibc_version == IBNAL_MSG_VERSION_RDMAREPLYNOTRSRVD) {
/* Can't block if RDMA completions need normal credits */
- LCONSOLE_ERROR("Dropping message from %s: no buffers free. "
+ LCONSOLE_ERROR(0x12d, "Dropping message from %s: no buffers free. "
"%s is running an old version of LNET that may "
"deadlock if messages wait for buffers)\n",
libcfs_nid2str(conn->ibc_peer->ibp_nid),
return 0;
case RDMA_CM_EVENT_DEVICE_REMOVAL:
- LCONSOLE_ERROR("Received notification of device removal\n");
- LCONSOLE_ERROR("Please shutdown LNET to allow this to proceed\n");
+ LCONSOLE_ERROR(0x131, "Received notification of device removal\n"
+ "Please shutdown LNET to allow this to proceed\n");
/* Can't remove network from underneath LNET for now, so I have
* to ignore this */
return 0;
if (conn->ibc_version == IBNAL_MSG_VERSION_RDMAREPLYNOTRSRVD) {
/* Can't block if RDMA completions need normal credits */
- LCONSOLE_ERROR("Dropping message from %s: no buffers free. "
+ LCONSOLE_ERROR(0x12a, "Dropping message from %s: no buffers free. "
"%s is running an old version of LNET that may "
"deadlock if messages wait for buffers)\n",
libcfs_nid2str(conn->ibc_peer->ibp_nid),
nactive = kptllnd_count_queue(&peer->peer_activeq);
spin_unlock_irqrestore(&peer->peer_lock, flags);
- LCONSOLE_ERROR("Timing out %s: %s\n",
+ LCONSOLE_ERROR(0x126, "Timing out %s: %s\n",
libcfs_id2str(peer->peer_id),
(tx->tx_tposted == 0) ?
"no free peer buffers" : "please check Portals");
void
kptllnd_peertable_overflow_msg(char *str, lnet_process_id_t id)
{
- LCONSOLE_ERROR("%s %s overflows the peer table[%d]: "
+ LCONSOLE_ERROR(0x127, "%s %s overflows the peer table[%d]: "
"messages may be dropped\n",
str, libcfs_id2str(id),
kptllnd_data.kptl_n_active_peers);
- LCONSOLE_ERROR("Please correct by increasing "
+ LCONSOLE_ERROR(0x128, "Please correct by increasing "
"'max_nodes' or 'max_procs_per_node'\n");
}
if (*kqswnal_tunables.kqn_credits >=
*kqswnal_tunables.kqn_ntxmsgs) {
- LCONSOLE_ERROR("Configuration error: please set "
+ LCONSOLE_ERROR(0x12e, "Configuration error: please set "
"ntxmsgs(%d) > credits(%d)\n",
*kqswnal_tunables.kqn_ntxmsgs,
*kqswnal_tunables.kqn_credits);
{
kra_conn_t *conn = (kra_conn_t *)private;
- LCONSOLE_ERROR("Dropping message from %s: no buffers free.\n",
+ LCONSOLE_ERROR(0x12b, "Dropping message from %s: no buffers free.\n",
libcfs_nid2str(conn->rac_peer->rap_nid));
return -EDEADLK;
LIBCFS_ALLOC(cr, sizeof(*cr));
if (cr == NULL) {
- LCONSOLE_ERROR("Dropping connection request from "
+ LCONSOLE_ERROR(0x12f, "Dropping connection request from "
"%u.%u.%u.%u: memory exhausted\n",
HIPQUAD(peer_ip));
return -ENOMEM;
*peerid = recv_id;
} else if (peerid->pid != recv_id.pid ||
!lnet_ptlcompat_matchnid(peerid->nid, recv_id.nid)) {
- LCONSOLE_ERROR("Connected successfully to %s on host "
+ LCONSOLE_ERROR(0x130, "Connected successfully to %s on host "
"%u.%u.%u.%u, but they claimed they were "
"%s; please check your Lustre "
"configuration.\n",
if (conn->ibc_version == IBNAL_MSG_VERSION_RDMAREPLYNOTRSRVD) {
/* Can't block if RDMA completions need normal credits */
- LCONSOLE_ERROR("Dropping message from %s: no buffers free. "
- "%s is running an old version of LNET that may "
- "deadlock if messages wait for buffers)\n",
- libcfs_nid2str(conn->ibc_peer->ibp_nid),
+ LCONSOLE_ERROR(0x129, "Dropping message from %s: no buffers "
+ " free. %s is running an old version of LNET "
+ "that may deadlock if messages wait for buffers)"
+ "\n", libcfs_nid2str(conn->ibc_peer->ibp_nid),
libcfs_nid2str(conn->ibc_peer->ibp_nid));
return -EDEADLK;
}
void
libcfs_setnet0alias(int lnd)
{
- LCONSOLE_ERROR("Liblustre cannot interoperate with old Portals.\n"
- "portals_compatibility must be set to 'none'.\n");
+ LCONSOLE_ERROR(0x125, "Liblustre cannot interoperate with old Portals."
+ "\nportals_compatibility must be set to 'none'.\n");
}
#endif
HIPQUAD(peer_ip), peer_port);
break;
case -ECONNRESET:
- LCONSOLE_ERROR("Connection to %s at host %u.%u.%u.%u on "
+ LCONSOLE_ERROR(0x11b, "Connection to %s at host %u.%u.%u.%u 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));
break;
case -EPROTO:
- LCONSOLE_ERROR("Protocol error connecting to %s at host "
+ LCONSOLE_ERROR(0x11c, "Protocol error connecting to %s at host "
"%u.%u.%u.%u on port %d: "
"is it running a compatible version of Lustre?\n",
libcfs_nid2str(peer_nid),
HIPQUAD(peer_ip), peer_port);
break;
case -EADDRINUSE:
- LCONSOLE_ERROR("No privileged ports available to connect to "
+ LCONSOLE_ERROR(0x11d, "No privileged ports available to connect to "
"%s at host %u.%u.%u.%u on port %d\n",
libcfs_nid2str(peer_nid),
HIPQUAD(peer_ip), peer_port);
break;
default:
- LCONSOLE_ERROR("Unexpected error %d connecting to %s at "
+ LCONSOLE_ERROR(0x11e, "Unexpected error %d connecting to %s at "
"host %u.%u.%u.%u on port %d\n", rc,
libcfs_nid2str(peer_nid),
HIPQUAD(peer_ip), peer_port);
else
str = "unrecognised";
- LCONSOLE_ERROR("Refusing connection from %u.%u.%u.%u magic %08x: "
+ LCONSOLE_ERROR(0x11f, "Refusing connection from %u.%u.%u.%u magic %08x: "
" %s acceptor protocol\n",
HIPQUAD(peer_ip), magic, str);
return -EPROTO;
ni->ni_nid != cr.acr_nid) { /* right NET, wrong NID! */
if (ni != NULL)
lnet_ni_decref(ni);
- LCONSOLE_ERROR("Refusing connection from %u.%u.%u.%u for %s: "
+ LCONSOLE_ERROR(0x120, "Refusing connection from %u.%u.%u.%u for %s: "
" No matching NI\n",
HIPQUAD(peer_ip), libcfs_nid2str(cr.acr_nid));
return -EPERM;
if (ni->ni_lnd->lnd_accept == NULL) {
/* This catches a request for the loopback LND */
lnet_ni_decref(ni);
- LCONSOLE_ERROR("Refusing connection from %u.%u.%u.%u for %s: "
+ LCONSOLE_ERROR(0x121, "Refusing connection from %u.%u.%u.%u for %s: "
" NI doesn not accept IP connections\n",
HIPQUAD(peer_ip), libcfs_nid2str(cr.acr_nid));
return -EPERM;
0, accept_port, accept_backlog);
if (rc != 0) {
if (rc == -EADDRINUSE)
- LCONSOLE_ERROR("Can't start acceptor on port %d: "
+ LCONSOLE_ERROR(0x122, "Can't start acceptor on port %d: "
"port already in use\n",
accept_port);
else
- LCONSOLE_ERROR("Can't start acceptor on port %d: "
+ LCONSOLE_ERROR(0x123, "Can't start acceptor on port %d: "
"unexpected error %d\n",
accept_port, rc);
} else if (!strcmp(accept, "none")) {
return 0;
} else {
- LCONSOLE_ERROR ("Can't parse 'accept=\"%s\"'\n",
+ LCONSOLE_ERROR (0x124, "Can't parse 'accept=\"%s\"'\n",
accept);
return -EINVAL;
}
int rc;
if (*networks != 0 && *ip2nets != 0) {
- LCONSOLE_ERROR("Please specify EITHER 'networks' or 'ip2nets'"
- " but not both at once\n");
+ LCONSOLE_ERROR(0x101, "Please specify EITHER 'networks' or "
+ "'ip2nets' but not both at once\n");
return NULL;
}
LCONSOLE_WARN("Starting in strong portals-compatible mode\n");
}
- LCONSOLE_ERROR("portals_compatibility=\"%s\" not supported\n",
+ LCONSOLE_ERROR(0x102, "portals_compatibility=\"%s\" not supported\n",
portals_compatibility);
return -EINVAL;
}
#ifdef NOT_YET
if (networks != NULL && ip2nets != NULL) {
- LCONSOLE_ERROR("Please set EITHER 'LNET_NETWORKS' or "
+ LCONSOLE_ERROR(0x103, "Please set EITHER 'LNET_NETWORKS' or "
"'LNET_IP2NETS' but not both at once\n");
return NULL;
}
libcfs_lnd2str(lnd_type),
libcfs_lnd2modname(lnd_type), rc);
#ifndef CONFIG_KMOD
- LCONSOLE_ERROR("Your kernel must be compiled "
- "with CONFIG_KMOD set for "
- "automatic module loading.");
+ LCONSOLE_ERROR(0x104, "Your kernel must be "
+ "compiled with CONFIG_KMOD set for "
+ "automatic module loading.");
#endif
goto failed;
}
LNET_MUTEX_UP(&the_lnet.ln_lnd_mutex);
if (rc != 0) {
- LCONSOLE_ERROR("Error %d starting up LNI %s\n",
+ LCONSOLE_ERROR(0x105, "Error %d starting up LNI %s\n",
rc, libcfs_lnd2str(lnd->lnd_type));
LNET_LOCK();
lnd->lnd_refcount--;
}
} else {
# ifndef HAVE_LIBPTHREAD
- LCONSOLE_ERROR("LND %s not supported in a "
+ LCONSOLE_ERROR(0x106, "LND %s not supported in a "
"single-threaded runtime\n",
libcfs_lnd2str(lnd_type));
goto failed;
#endif
if (ni->ni_peertxcredits == 0 ||
ni->ni_maxtxcredits == 0) {
- LCONSOLE_ERROR("LNI %s has no %scredits\n",
+ LCONSOLE_ERROR(0x107, "LNI %s has no %scredits\n",
libcfs_lnd2str(lnd->lnd_type),
ni->ni_peertxcredits == 0 ?
"" : "per-peer ");
/* Handle nidstrings for network 0 just like this one */
if (the_lnet.ln_ptlcompat > 0) {
if (nicount > 0) {
- LCONSOLE_ERROR("Can't run > 1 network when "
- "portals_compatibility is set\n");
+ LCONSOLE_ERROR(0x108, "Can't run > 1 network "
+ "when portals_compatibility is set\n");
goto failed;
}
libcfs_setnet0alias(lnd->lnd_type);
if (the_lnet.ln_eqwaitni != NULL && nicount > 1) {
lnd_type = the_lnet.ln_eqwaitni->ni_lnd->lnd_type;
- LCONSOLE_ERROR("LND %s can only run single-network\n",
+ LCONSOLE_ERROR(0x109, "LND %s can only run single-network\n",
libcfs_lnd2str(lnd_type));
goto failed;
}
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",
+ LCONSOLE_ERROR(0x10f, "Error parsing '%s=\"%s\"'\n", name, str);
+ LCONSOLE_ERROR(0x110, "here...........%.*s..%.*s|%.*s|\n",
(int)strlen(name), dots, offset, dots,
(width < 1) ? 0 : width - 1, dashes);
}
lnet_ni_t *ni;
if (!lnet_net_unique(net, nilist)) {
- LCONSOLE_ERROR("Duplicate network specified: %s\n",
+ LCONSOLE_ERROR(0x111, "Duplicate network specified: %s\n",
libcfs_net2str(net));
return NULL;
}
if (strlen(networks) > LNET_SINGLE_TEXTBUF_NOB) {
/* _WAY_ conservative */
- LCONSOLE_ERROR("Can't parse networks: string too long\n");
+ LCONSOLE_ERROR(0x112, "Can't parse networks: string too long\n");
return -EINVAL;
}
if (net == LNET_NIDNET(LNET_NID_ANY)) {
lnet_syntax("networks", networks,
str - tokens, strlen(str));
- LCONSOLE_ERROR("Unrecognised network type\n");
+ LCONSOLE_ERROR(0x113, "Unrecognised network type\n");
goto failed;
}
if (nnets > 0 &&
the_lnet.ln_ptlcompat > 0) {
- LCONSOLE_ERROR("Only 1 network supported when "
+ LCONSOLE_ERROR(0x114, "Only 1 network supported when "
"'portals_compatible' is set\n");
goto failed;
}
}
if (niface == LNET_MAX_INTERFACES) {
- LCONSOLE_ERROR("Too many interfaces for net %s\n",
+ LCONSOLE_ERROR(0x115, "Too many interfaces for net %s\n",
libcfs_net2str(net));
goto failed;
}
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 "
+ LCONSOLE_ERROR(0x116, "Route tables are not supported when "
"'portals_compatible' is set\n");
return -EINVAL;
}
int rc;
if (nip < 0) {
- LCONSOLE_ERROR("Error %d enumerating local IP interfaces "
+ LCONSOLE_ERROR(0x117, "Error %d enumerating local IP interfaces "
"for ip2nets to match\n", nip);
return nip;
}
if (nip == 0) {
- LCONSOLE_ERROR("No local IP interfaces "
+ LCONSOLE_ERROR(0x118, "No local IP interfaces "
"for ip2nets to match\n");
return -ENOENT;
}
lnet_ipaddr_free_enumeration(ipaddrs, nip);
if (rc < 0) {
- LCONSOLE_ERROR("Error %d parsing ip2nets\n", rc);
+ LCONSOLE_ERROR(0x119, "Error %d parsing ip2nets\n", rc);
return rc;
}
if (rc == 0) {
- LCONSOLE_ERROR("ip2nets does not match "
+ LCONSOLE_ERROR(0x11a, "ip2nets does not match "
"any local IP interfaces\n");
return -ENOENT;
}
if (check_routers_before_use &&
dead_router_check_interval <= 0) {
- LCONSOLE_ERROR("'dead_router_check_interval' must be set if "
+ LCONSOLE_ERROR(0x10a, "'dead_router_check_interval' must be set if "
"'check_routers_before_use' is set\n");
return -EINVAL;
}
} else if (!strcmp(forwarding, "enabled")) {
/* explicitly enabled */
} else {
- LCONSOLE_ERROR("'forwarding' not set to either "
+ LCONSOLE_ERROR(0x10b, "'forwarding' not set to either "
"'enabled' or 'disabled'\n");
return -EINVAL;
}
if (tiny_router_buffers <= 0) {
- LCONSOLE_ERROR("tiny_router_buffers=%d invalid when "
+ LCONSOLE_ERROR(0x10c, "tiny_router_buffers=%d invalid when "
"routing enabled\n", tiny_router_buffers);
rc = -EINVAL;
goto failed;
goto failed;
if (small_router_buffers <= 0) {
- LCONSOLE_ERROR("small_router_buffers=%d invalid when "
+ LCONSOLE_ERROR(0x10d, "small_router_buffers=%d invalid when "
"routing enabled\n", small_router_buffers);
rc = -EINVAL;
goto failed;
goto failed;
if (large_router_buffers <= 0) {
- LCONSOLE_ERROR("large_router_buffers=%d invalid when "
+ LCONSOLE_ERROR(0x10e, "large_router_buffers=%d invalid when "
"routing enabled\n", large_router_buffers);
rc = -EINVAL;
goto failed;