-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
* GPL HEADER START
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
- */
-/*
- * Copyright (c) 2011 Whamcloud, Inc.
+ *
+ * Copyright (c) 2011, Whamcloud, Inc.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
EXPORT_SYMBOL(ptlrpc_init_import);
#define UUID_STR "_UUID"
-static void deuuidify(char *uuid, const char *prefix, char **uuid_start,
- int *uuid_len)
+void deuuidify(char *uuid, const char *prefix, char **uuid_start, int *uuid_len)
{
*uuid_start = !prefix || strncmp(uuid, prefix, strlen(prefix))
? uuid : uuid + strlen(prefix);
UUID_STR, strlen(UUID_STR)))
*uuid_len -= strlen(UUID_STR);
}
+EXPORT_SYMBOL(deuuidify);
/**
* Returns true if import was FULL, false if import was already not
&target_start, &target_len);
if (imp->imp_replayable) {
- LCONSOLE_WARN("%s: Connection to service %.*s via nid "
- "%s was lost; in progress operations using this "
- "service will wait for recovery to complete.\n",
+ LCONSOLE_WARN("%s: Connection to %.*s (at %s) was "
+ "lost; in progress operations using this "
+ "service will wait for recovery to complete\n",
imp->imp_obd->obd_name, target_len, target_start,
libcfs_nid2str(imp->imp_connection->c_peer.nid));
} else {
- LCONSOLE_ERROR_MSG(0x166, "%s: Connection to service "
- "%.*s via nid %s was lost; in progress "
- "operations using this service will fail.\n",
+ LCONSOLE_ERROR_MSG(0x166, "%s: Connection to "
+ "%.*s (at %s) was lost; in progress "
+ "operations using this service will fail\n",
imp->imp_obd->obd_name,
target_len, target_start,
libcfs_nid2str(imp->imp_connection->c_peer.nid));
{
struct obd_import_conn *imp_conn = NULL, *conn;
struct obd_export *dlmexp;
- int tried_all = 1;
+ char *target_start;
+ int target_len, tried_all = 1;
ENTRY;
cfs_spin_lock(&imp->imp_lock);
state associated with the last connection attempt to drain before
trying to reconnect on it.) */
if (tried_all && (imp->imp_conn_list.next == &imp_conn->oic_item)) {
- if (at_get(&imp->imp_at.iat_net_latency) <
- CONNECTION_SWITCH_MAX) {
- at_measured(&imp->imp_at.iat_net_latency,
- at_get(&imp->imp_at.iat_net_latency) +
- CONNECTION_SWITCH_INC);
- }
- LASSERT(imp_conn->oic_last_attempt);
- CWARN("%s: tried all connections, increasing latency to %ds\n",
- imp->imp_obd->obd_name,
- at_get(&imp->imp_at.iat_net_latency));
- }
+ struct adaptive_timeout *at = &imp->imp_at.iat_net_latency;
+ if (at_get(at) < CONNECTION_SWITCH_MAX) {
+ at_measured(at, at_get(at) + CONNECTION_SWITCH_INC);
+ if (at_get(at) > CONNECTION_SWITCH_MAX)
+ at_reset(at, CONNECTION_SWITCH_MAX);
+ }
+ LASSERT(imp_conn->oic_last_attempt);
+ CDEBUG(D_HA, "%s: tried all connections, increasing latency "
+ "to %ds\n", imp->imp_obd->obd_name, at_get(at));
+ }
imp_conn->oic_last_attempt = cfs_time_current_64();
class_export_put(dlmexp);
if (imp->imp_conn_current != imp_conn) {
- if (imp->imp_conn_current)
- CDEBUG(D_HA, "Changing connection for %s to %s/%s\n",
- imp->imp_obd->obd_name, imp_conn->oic_uuid.uuid,
+ if (imp->imp_conn_current) {
+ deuuidify(obd2cli_tgt(imp->imp_obd), NULL,
+ &target_start, &target_len);
+
+ CDEBUG(D_HA, "%s: Connection changing to"
+ " %.*s (at %s)\n",
+ imp->imp_obd->obd_name,
+ target_len, target_start,
libcfs_nid2str(imp_conn->oic_conn->c_peer.nid));
+ }
+
imp->imp_conn_current = imp_conn;
}
* actual sending.
* Returns 0 on success or error code.
*/
-int ptlrpc_connect_import(struct obd_import *imp, char *new_uuid)
+int ptlrpc_connect_import(struct obd_import *imp)
{
struct obd_device *obd = imp->imp_obd;
int initial_connect = 0;
&imp->imp_connect_data.ocd_transno);
cfs_spin_unlock(&imp->imp_lock);
- if (new_uuid) {
- struct obd_uuid uuid;
-
- obd_str2uuid(&uuid, new_uuid);
- rc = import_set_conn_priority(imp, &uuid);
- if (rc)
- GOTO(out, rc);
- }
-
rc = import_select_connection(imp);
if (rc)
GOTO(out, rc);
DEBUG_REQ(D_RPCTRACE, request, "(re)connect request (timeout %d)",
request->rq_timeout);
- ptlrpcd_add_req(request, PSCOPE_OTHER);
+ ptlrpcd_add_req(request, PDL_POLICY_ROUND, -1);
rc = 0;
out:
if (rc != 0) {
static void ptlrpc_maybe_ping_import_soon(struct obd_import *imp)
{
#ifdef __KERNEL__
- /* the pinger takes care of issuing the next reconnect request */
- return;
+ int force_verify;
+
+ cfs_spin_lock(&imp->imp_lock);
+ force_verify = imp->imp_force_verify != 0;
+ cfs_spin_unlock(&imp->imp_lock);
+
+ if (force_verify)
+ ptlrpc_pinger_wake_up();
#else
/* liblustre has no pinger thread, so we wakeup pinger anyway */
ptlrpc_pinger_wake_up();
* for connecting*/
imp->imp_force_reconnect = ptlrpc_busy_reconnect(rc);
cfs_spin_unlock(&imp->imp_lock);
+ ptlrpc_maybe_ping_import_soon(imp);
GOTO(out, rc);
}
/* All imports are pingable */
imp->imp_pingable = 1;
imp->imp_force_reconnect = 0;
+ imp->imp_force_verify = 0;
if (aa->pcaa_initial_connect) {
if (msg_flags & MSG_CONNECT_REPLAYABLE) {
memset(&old_hdl, 0, sizeof(old_hdl));
if (!memcmp(&old_hdl, lustre_msg_get_handle(request->rq_repmsg),
sizeof (old_hdl))) {
- CERROR("%s@%s didn't like our handle "LPX64
- ", failed\n", obd2cli_tgt(imp->imp_obd),
- imp->imp_connection->c_remote_uuid.uuid,
- imp->imp_dlm_handle.cookie);
+ LCONSOLE_WARN("Reconnect to %s (at @%s) failed due "
+ "bad handle "LPX64"\n",
+ obd2cli_tgt(imp->imp_obd),
+ imp->imp_connection->c_remote_uuid.uuid,
+ imp->imp_dlm_handle.cookie);
GOTO(out, rc = -ENOTCONN);
}
* eviction. If it is in recovery - we are safe to
* participate since we can reestablish all of our state
* with server again */
- CDEBUG(level,"%s@%s changed server handle from "
- LPX64" to "LPX64"%s\n",
- obd2cli_tgt(imp->imp_obd),
- imp->imp_connection->c_remote_uuid.uuid,
- imp->imp_remote_handle.cookie,
- lustre_msg_get_handle(request->rq_repmsg)->
- cookie,
- (MSG_CONNECT_RECOVERING & msg_flags) ?
- " but is still in recovery" : "");
+ if ((MSG_CONNECT_RECOVERING & msg_flags)) {
+ CDEBUG(level,"%s@%s changed server handle from "
+ LPX64" to "LPX64
+ " but is still in recovery\n",
+ obd2cli_tgt(imp->imp_obd),
+ imp->imp_connection->c_remote_uuid.uuid,
+ imp->imp_remote_handle.cookie,
+ lustre_msg_get_handle(
+ request->rq_repmsg)->cookie);
+ } else {
+ LCONSOLE_WARN("Evicted from %s (at %s) "
+ "after server handle changed from "
+ LPX64" to "LPX64"\n",
+ obd2cli_tgt(imp->imp_obd),
+ imp->imp_connection-> \
+ c_remote_uuid.uuid,
+ imp->imp_remote_handle.cookie,
+ lustre_msg_get_handle(
+ request->rq_repmsg)->cookie);
+ }
+
imp->imp_remote_handle =
*lustre_msg_get_handle(request->rq_repmsg);
"invalidating and reconnecting\n",
obd2cli_tgt(imp->imp_obd),
imp->imp_connection->c_remote_uuid.uuid);
- ptlrpc_connect_import(imp, NULL);
+ ptlrpc_connect_import(imp);
RETURN(0);
}
} else {
}
imp->imp_connect_data = *ocd;
+ CDEBUG(D_HA, "obd %s to target with inst %u\n",
+ imp->imp_obd->obd_name, ocd->ocd_instance);
exp = class_conn2export(&imp->imp_dlm_handle);
cfs_spin_unlock(&imp->imp_lock);
newer : older, LUSTRE_VERSION_STRING);
}
- if (ocd->ocd_connect_flags & OBD_CONNECT_CKSUM) {
- /* We sent to the server ocd_cksum_types with bits set
- * for algorithms we understand. The server masked off
- * the checksum types it doesn't support */
- if ((ocd->ocd_cksum_types & OBD_CKSUM_ALL) == 0) {
- LCONSOLE_WARN("The negotiation of the checksum "
- "alogrithm to use with server %s "
- "failed (%x/%x), disabling "
- "checksums\n",
- obd2cli_tgt(imp->imp_obd),
- ocd->ocd_cksum_types,
- OBD_CKSUM_ALL);
- cli->cl_checksum = 0;
- cli->cl_supp_cksum_types = OBD_CKSUM_CRC32;
- cli->cl_cksum_type = OBD_CKSUM_CRC32;
- } else {
- cli->cl_supp_cksum_types = ocd->ocd_cksum_types;
-
- if (ocd->ocd_cksum_types & OSC_DEFAULT_CKSUM)
- cli->cl_cksum_type = OSC_DEFAULT_CKSUM;
- else if (ocd->ocd_cksum_types & OBD_CKSUM_ADLER)
- cli->cl_cksum_type = OBD_CKSUM_ADLER;
- else
- cli->cl_cksum_type = OBD_CKSUM_CRC32;
- }
- } else {
- /* The server does not support OBD_CONNECT_CKSUM.
- * Enforce CRC32 for backward compatibility*/
- cli->cl_supp_cksum_types = OBD_CKSUM_CRC32;
- cli->cl_cksum_type = OBD_CKSUM_CRC32;
- }
+ if (ocd->ocd_connect_flags & OBD_CONNECT_CKSUM) {
+ /* We sent to the server ocd_cksum_types with bits set
+ * for algorithms we understand. The server masked off
+ * the checksum types it doesn't support */
+ if ((ocd->ocd_cksum_types &
+ cksum_types_supported_client()) == 0) {
+ LCONSOLE_WARN("The negotiation of the checksum "
+ "alogrithm to use with server %s "
+ "failed (%x/%x), disabling "
+ "checksums\n",
+ obd2cli_tgt(imp->imp_obd),
+ ocd->ocd_cksum_types,
+ cksum_types_supported_client());
+ cli->cl_checksum = 0;
+ cli->cl_supp_cksum_types = OBD_CKSUM_ADLER;
+ } else {
+ cli->cl_supp_cksum_types = ocd->ocd_cksum_types;
+ }
+ } else {
+ /* The server does not support OBD_CONNECT_CKSUM.
+ * Enforce ADLER for backward compatibility*/
+ cli->cl_supp_cksum_types = OBD_CKSUM_ADLER;
+ }
+ cli->cl_cksum_type =cksum_type_select(cli->cl_supp_cksum_types);
if (ocd->ocd_connect_flags & OBD_CONNECT_BRW_SIZE)
cli->cl_max_pages_per_rpc =
req->rq_import->imp_obd->obd_name,
req->rq_status);
}
- ptlrpc_connect_import(req->rq_import, NULL);
+ ptlrpc_connect_import(req->rq_import);
}
RETURN(0);
req->rq_timeout *= 3;
req->rq_interpret_reply = completed_replay_interpret;
- ptlrpcd_add_req(req, PSCOPE_OTHER);
+ ptlrpcd_add_req(req, PDL_POLICY_ROUND, -1);
RETURN(0);
}
deuuidify(obd2cli_tgt(imp->imp_obd), NULL,
&target_start, &target_len);
- LCONSOLE_INFO("%s: Connection restored to service %.*s "
- "using nid %s.\n", imp->imp_obd->obd_name,
+ LCONSOLE_INFO("%s: Connection restored to %.*s (at %s)\n",
+ imp->imp_obd->obd_name,
target_len, target_start,
libcfs_nid2str(imp->imp_connection->c_peer.nid));
}