#include "ptlrpc_internal.h"
struct ptlrpc_connect_async_args {
- __u64 pcaa_peer_committed;
- int pcaa_initial_connect;
+ __u64 pcaa_peer_committed;
+ int pcaa_initial_connect;
};
/**
ptlrpc_import_state_name(state));
}
- imp->imp_state = state;
- imp->imp_state_hist[imp->imp_state_hist_idx].ish_state = state;
- imp->imp_state_hist[imp->imp_state_hist_idx].ish_time =
+ imp->imp_state = state;
+ imp->imp_state_hist[imp->imp_state_hist_idx].ish_state = state;
+ imp->imp_state_hist[imp->imp_state_hist_idx].ish_time =
ktime_get_real_seconds();
- imp->imp_state_hist_idx = (imp->imp_state_hist_idx + 1) %
- IMP_STATE_HIST_LEN;
+ imp->imp_state_hist_idx = (imp->imp_state_hist_idx + 1) %
+ IMP_STATE_HIST_LEN;
}
static void import_set_state(struct obd_import *imp,
* CLOSED. I would rather refcount the import and free it after
* disconnection like we do with exports. To do that, the client_obd
* will need to save the peer info somewhere other than in the import,
- * though. */
+ * though.
+ */
int ptlrpc_init_import(struct obd_import *imp)
{
spin_lock(&imp->imp_lock);
#define UUID_STR "_UUID"
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_start = !prefix || strncmp(uuid, prefix, strlen(prefix))
+ ? uuid : uuid + strlen(prefix);
- *uuid_len = strlen(*uuid_start);
+ *uuid_len = strlen(*uuid_start);
- if (*uuid_len < strlen(UUID_STR))
- return;
+ if (*uuid_len < strlen(UUID_STR))
+ return;
- if (!strncmp(*uuid_start + *uuid_len - strlen(UUID_STR),
- UUID_STR, strlen(UUID_STR)))
- *uuid_len -= strlen(UUID_STR);
+ if (!strncmp(*uuid_start + *uuid_len - strlen(UUID_STR),
+ UUID_STR, strlen(UUID_STR)))
+ *uuid_len -= strlen(UUID_STR);
}
/* Must be called with imp_lock held! */
spin_lock(&imp->imp_lock);
- if (imp->imp_state == LUSTRE_IMP_FULL &&
- (conn_cnt == 0 || conn_cnt == imp->imp_conn_cnt)) {
- char *target_start;
- int target_len;
+ if (imp->imp_state == LUSTRE_IMP_FULL &&
+ (conn_cnt == 0 || conn_cnt == imp->imp_conn_cnt)) {
+ char *target_start;
+ int target_len;
bool inact = false;
- deuuidify(obd2cli_tgt(imp->imp_obd), NULL,
- &target_start, &target_len);
+ deuuidify(obd2cli_tgt(imp->imp_obd), NULL,
+ &target_start, &target_len);
import_set_state_nolock(imp, LUSTRE_IMP_DISCON);
- if (imp->imp_replayable) {
- 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,
+ if (imp->imp_replayable) {
+ 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,
obd_import_nid2str(imp));
} else {
- LCONSOLE_ERROR_MSG(0x166, "%s: Connection to "
- "%.*s (at %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,
obd_import_nid2str(imp));
if (invalid) {
- CDEBUG(D_HA, "import %s@%s for %s not "
- "replayable, auto-deactivating\n",
+ CDEBUG(D_HA,
+ "import %s@%s for %s not replayable, auto-deactivating\n",
obd2cli_tgt(imp->imp_obd),
imp->imp_connection->c_remote_uuid.uuid,
imp->imp_obd->obd_name);
rc = 1;
} else {
spin_unlock(&imp->imp_lock);
- CDEBUG(D_HA, "%s: import %p already %s (conn %u, was %u): %s\n",
- imp->imp_client->cli_name, imp,
- (imp->imp_state == LUSTRE_IMP_FULL &&
- imp->imp_conn_cnt > conn_cnt) ?
- "reconnected" : "not connected", imp->imp_conn_cnt,
- conn_cnt, ptlrpc_import_state_name(imp->imp_state));
- }
-
- return rc;
+ CDEBUG(D_HA, "%s: import %p already %s (conn %u, was %u): %s\n",
+ imp->imp_client->cli_name, imp,
+ (imp->imp_state == LUSTRE_IMP_FULL &&
+ imp->imp_conn_cnt > conn_cnt) ?
+ "reconnected" : "not connected", imp->imp_conn_cnt,
+ conn_cnt, ptlrpc_import_state_name(imp->imp_state));
+ }
+
+ return rc;
}
/*
{
time64_t dl;
- if (!(((req->rq_phase == RQ_PHASE_RPC) && !req->rq_waiting) ||
- (req->rq_phase == RQ_PHASE_BULK) ||
- (req->rq_phase == RQ_PHASE_NEW)))
- return 0;
+ if (!(((req->rq_phase == RQ_PHASE_RPC) && !req->rq_waiting) ||
+ (req->rq_phase == RQ_PHASE_BULK) ||
+ (req->rq_phase == RQ_PHASE_NEW)))
+ return 0;
- if (req->rq_timedout)
- return 0;
+ if (req->rq_timedout)
+ return 0;
- if (req->rq_phase == RQ_PHASE_NEW)
- dl = req->rq_sent;
- else
- dl = req->rq_deadline;
+ if (req->rq_phase == RQ_PHASE_NEW)
+ dl = req->rq_sent;
+ else
+ dl = req->rq_deadline;
- if (dl <= now)
- return 0;
+ if (dl <= now)
+ return 0;
- return dl - now;
+ return dl - now;
}
static time64_t ptlrpc_inflight_timeout(struct obd_import *imp)
/* We know that "unregistering" rpcs only can
* survive in sending or delaying lists (they
* maybe waiting for long reply unlink in
- * sluggish nets). Let's check this. If there
- * is no inflight and unregistering != 0, this
- * is bug. */
- LASSERTF(count == 0, "Some RPCs are still "
- "unregistering: %d\n", count);
+ * sluggish nets). Check this. If there is no
+ * inflight and unregistering != 0, this is bug
+ */
+ LASSERTF(count == 0, "Some RPCs are still unregistering: %d\n",
+ count);
/* Let's save one loop as soon as inflight have
* dropped to zero. No new inflights possible at
- * this point. */
+ * this point.
+ */
rc = 1;
} else {
list_for_each_entry(req, &imp->imp_sending_list,
"still on delayed list");
}
- CERROR("%s: Unregistering RPCs found (%d). "
- "Network is sluggish? Waiting for them "
- "to error out.\n", cli_tgt,
+ CERROR("%s: Unregistering RPCs found (%d). Network is sluggish? Waiting for them to error out.\n",
+ cli_tgt,
atomic_read(&imp->imp_unregistering));
}
spin_unlock(&imp->imp_lock);
int ptlrpc_reconnect_import(struct obd_import *imp)
{
int rc = 0;
+
ENTRY;
ptlrpc_set_import_discon(imp, 0, true);
char *target_start;
int target_len, tried_all = 1;
int rc = 0;
+
ENTRY;
spin_lock(&imp->imp_lock);
deuuidify(obd2cli_tgt(imp->imp_obd), NULL,
&target_start, &target_len);
- CDEBUG(D_HA, "%s: Connection changing to"
- " %.*s (at %s)\n",
+ CDEBUG(D_HA, "%s: Connection changing to %.*s (at %s)\n",
imp->imp_obd->obd_name,
target_len, target_start,
libcfs_nidstr(&imp_conn->oic_conn->c_peer.nid));
struct ptlrpc_request *req;
/* The requests in committed_list always have smaller transnos than
- * the requests in replay_list */
+ * the requests in replay_list
+ */
if (!list_empty(&imp->imp_committed_list)) {
req = list_first_entry(&imp->imp_committed_list,
struct ptlrpc_request, rq_replay_list);
NULL };
struct ptlrpc_connect_async_args *aa;
int rc;
+
ENTRY;
assert_spin_locked(&imp->imp_lock);
GOTO(out, rc);
/* Reset connect flags to the originally requested flags, in case
- * the server is updated on-the-fly we will get the new features. */
+ * the server is updated on-the-fly we will get the new features.
+ */
ocd = imp->imp_connect_data;
ocd.ocd_connect_flags = imp->imp_connect_flags_orig;
ocd.ocd_connect_flags2 = imp->imp_connect_flags2_orig;
}
/* Report the rpc service time to the server so that it knows how long
- * to wait for clients to join recovery */
+ * to wait for clients to join recovery
+ */
lustre_msg_set_service_timeout(request->rq_reqmsg,
at_timeout2est(request->rq_timeout));
* import_select_connection will increase the net latency on
* repeated reconnect attempts to cover slow networks.
* We override/ignore the server rpc completion estimate here,
- * which may be large if this is a reconnect attempt */
+ * which may be large if this is a reconnect attempt
+ */
request->rq_timeout = INITIAL_CONNECT_TIMEOUT;
lustre_msg_set_timeout(request->rq_reqmsg, request->rq_timeout);
request->rq_interpret_reply = ptlrpc_connect_interpret;
aa = ptlrpc_req_async_args(aa, request);
- memset(aa, 0, sizeof *aa);
+ memset(aa, 0, sizeof(*aa));
aa->pcaa_peer_committed = committed_before_reconnect;
aa->pcaa_initial_connect = initial_connect;
static int ptlrpc_busy_reconnect(int rc)
{
- return (rc == -EBUSY) || (rc == -EAGAIN);
+ return (rc == -EBUSY) || (rc == -EAGAIN);
}
static int ptlrpc_connect_set_flags(struct obd_import *imp,
LUSTRE_VERSION_OFFSET_WARN ||
ocd->ocd_version < LUSTRE_VERSION_CODE -
LUSTRE_VERSION_OFFSET_WARN)) {
- /* Sigh, some compilers do not like #ifdef in the middle
- of macro arguments */
- const char *older = "older than client. "
- "Consider upgrading server";
- const char *newer = "newer than client. "
- "Consider upgrading client";
+ /* few compiler do not like #ifdef in middle of macro argument*/
+ const char *older = "older than client. Consider upgrading server"
+ ;
+ const char *newer = "newer than client. Consider upgrading client"
+ ;
LCONSOLE_WARN("Client version (%s). Server %s version (%d.%d.%d.%d) is much %s\n",
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 */
+ * the checksum types it doesn't support
+ */
if ((ocd->ocd_cksum_types &
obd_cksum_types_supported_client()) == 0) {
- LCONSOLE_ERROR("The negotiation of the checksum "
- "alogrithm to use with server %s "
- "failed (%x/%x)\n",
+ LCONSOLE_ERROR("The negotiation of the checksum alogrithm to use with server %s failed (%x/%x)\n",
obd2cli_tgt(imp->imp_obd),
ocd->ocd_cksum_types,
obd_cksum_types_supported_client());
return -EPROTO;
- } else {
- cli->cl_supp_cksum_types = ocd->ocd_cksum_types;
}
+ cli->cl_supp_cksum_types = ocd->ocd_cksum_types;
} else {
/* The server does not support OBD_CONNECT_CKSUM.
- * Enforce ADLER for backward compatibility*/
+ * Enforce ADLER for backward compatibility
+ */
cli->cl_supp_cksum_types = OBD_CKSUM_ADLER;
}
cli->cl_cksum_type = obd_cksum_type_select(imp->imp_obd->obd_name,
client_adjust_max_dirty(cli);
/* Update client max modify RPCs in flight with value returned
- * by the server */
+ * by the server
+ */
if (ocd->ocd_connect_flags & OBD_CONNECT_MULTIMODRPCS)
cli->cl_max_mod_rpcs_in_flight = min(
cli->cl_max_mod_rpcs_in_flight,
else
cli->cl_max_mod_rpcs_in_flight = 1;
- /* Reset ns_connect_flags only for initial connect. It might be
- * changed in while using FS and if we reset it in reconnect
- * this leads to losing user settings done before such as
- * disable lru_resize, etc. */
+ /* Reset ns_connect_flags only for initial connect. Might be changed
+ * while using FS and if we reset it in reconnect this leads to losing
+ * user settings done before such as disable lru_resize, etc.
+ */
if (old_connect_flags != exp_connect_flags(exp) || init_connect) {
struct ldlm_namespace *ns = imp->imp_obd->obd_namespace;
__u64 changed_flags;
changed_flags =
ns->ns_connect_flags ^ ns->ns_orig_connect_flags;
- CDEBUG(D_HA, "%s: Resetting ns_connect_flags to server "
- "flags: %#llx\n", imp->imp_obd->obd_name,
+ CDEBUG(D_HA, "%s: Resetting ns_connect_flags to server flags: %#llx\n",
+ imp->imp_obd->obd_name,
ocd->ocd_connect_flags);
ns->ns_connect_flags = (ns->ns_connect_flags & changed_flags) |
(ocd->ocd_connect_flags & ~changed_flags);
* b. failovered server means export and flags are gone
* (in ptlrpc_send_reply).
* Can only be set when we know AT is supported at
- * both ends */
+ * both ends
+ */
imp->imp_msghdr_flags |= MSGHDR_AT_SUPPORT;
else
imp->imp_msghdr_flags &= ~MSGHDR_AT_SUPPORT;
return;
/* If the server was restart during repaly, the requests may
- * have been added to the unreplied list in former replay. */
+ * have been added to the unreplied list in former replay.
+ */
spin_lock(&imp->imp_lock);
list_for_each_entry(req, &imp->imp_committed_list, rq_replay_list) {
struct obd_connect_data *ocd;
struct obd_export *exp = NULL;
int ret;
+
ENTRY;
spin_lock(&imp->imp_lock);
}
/* if this reconnect to busy export - not need select new target
- * for connecting*/
+ * for connecting
+ */
imp->imp_force_reconnect = ptlrpc_busy_reconnect(rc);
spin_unlock(&imp->imp_lock);
GOTO(out, rc);
/* LU-7558: indicate that we are interpretting connect reply,
* pltrpc_connect_import() will not try to reconnect until
- * interpret will finish. */
+ * interpret will finish.
+ */
imp->imp_connected = 1;
spin_unlock(&imp->imp_lock);
spin_unlock(&imp->imp_lock);
if (!exp) {
- /* This could happen if export is cleaned during the
- connect attempt */
+ /* Could happen if export is cleaned during connect attempt */
CERROR("%s: missing export after connect\n",
imp->imp_obd->obd_name);
GOTO(out, rc = -ENODEV);
/* check that server granted subset of flags we asked for. */
if ((ocd->ocd_connect_flags & imp->imp_connect_flags_orig) !=
ocd->ocd_connect_flags) {
- CERROR("%s: Server didn't grant requested subset of flags: "
- "asked=%#llx granted=%#llx\n",
+ CERROR("%s: Server didn't grant requested subset of flags: asked=%#llx granted=%#llx\n",
imp->imp_obd->obd_name, imp->imp_connect_flags_orig,
ocd->ocd_connect_flags);
GOTO(out, rc = -EPROTO);
if ((ocd->ocd_connect_flags2 & imp->imp_connect_flags2_orig) !=
ocd->ocd_connect_flags2) {
- CERROR("%s: Server didn't grant requested subset of flags2: "
- "asked=%#llx granted=%#llx\n",
+ CERROR("%s: Server didn't grant requested subset of flags2: asked=%#llx granted=%#llx\n",
imp->imp_obd->obd_name, imp->imp_connect_flags2_orig,
ocd->ocd_connect_flags2);
GOTO(out, rc = -EPROTO);
__u32 patch = OBD_OCD_VERSION_PATCH(ocd->ocd_version);
/* We do not support the MDT-MDT interoperations with
- * different version MDT because of protocol changes. */
+ * different version MDT because of protocol changes.
+ */
if (unlikely(major != LUSTRE_MAJOR ||
minor != LUSTRE_MINOR ||
abs(patch - LUSTRE_PATCH) > 3)) {
- LCONSOLE_WARN("%s: import %p (%u.%u.%u.%u) tried the "
- "connection to different version MDT "
- "(%d.%d.%d.%d) %s\n",
+ LCONSOLE_WARN("%s: import %p (%u.%u.%u.%u) tried the connection to different version MDT (%d.%d.%d.%d) %s\n",
imp->imp_obd->obd_name, imp, LUSTRE_MAJOR,
LUSTRE_MINOR, LUSTRE_PATCH, LUSTRE_FIX,
major, minor, patch,
memset(&old_hdl, 0, sizeof(old_hdl));
if (!memcmp(&old_hdl, lustre_msg_get_handle(request->rq_repmsg),
sizeof(old_hdl))) {
- LCONSOLE_WARN("Reconnect to %s (at @%s) failed due "
- "bad handle %#llx\n",
+ LCONSOLE_WARN("Reconnect to %s (at @%s) failed due bad handle %#llx\n",
obd2cli_tgt(imp->imp_obd),
imp->imp_connection->c_remote_uuid.uuid,
imp->imp_dlm_handle.cookie);
*/
if ((MSG_CONNECT_RECOVERING & msg_flags)) {
CDEBUG_LIMIT(level,
- "%s@%s changed server handle from "
- "%#llx to %#llx"
- " but is still in recovery\n",
+ "%s@%s changed server handle from %#llx to %#llx 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 "
- "%#llx to %#llx\n",
+ LCONSOLE_WARN("Evicted from %s (at %s) after server handle changed from %#llx to %#llx\n",
obd2cli_tgt(imp->imp_obd),
- imp->imp_connection->
- c_remote_uuid.uuid,
+ imp->imp_connection->c_remote_uuid.uuid,
imp->imp_remote_handle.cookie,
lustre_msg_get_handle(
- request->rq_repmsg)->cookie);
+ request->rq_repmsg)->cookie);
}
imp->imp_remote_handle =
/* The below message is checked in recovery-small.sh test_54 */
CERROR("%s: went back in time (transno %lld was previously committed, server now claims %lld)!\n",
obd2cli_tgt(imp->imp_obd), aa->pcaa_peer_committed,
- lustre_msg_get_last_committed(request->rq_repmsg));
+ lustre_msg_get_last_committed(request->rq_repmsg));
if (!printed) {
CERROR("For further information, see http://doc.lustre.org/lustre_manual.xhtml#went_back_in_time\n");
printed = true;
}
- }
+ }
finish:
ptlrpc_prepare_replay(imp);
/* Servers are not supposed to refuse connections from
* clients based on version, only connection feature
* flags. We should never see this from llite, but it
- * may be useful for debugging in the future. */
+ * may be useful for debugging in the future.
+ */
if (ocd &&
(ocd->ocd_connect_flags & OBD_CONNECT_VERSION) &&
(ocd->ocd_version != LUSTRE_VERSION_CODE)) {
- LCONSOLE_ERROR_MSG(0x16a, "Server %s version "
- "(%d.%d.%d.%d)"
- " refused connection from this client "
- "with an incompatible version (%s). "
- "Client must be recompiled\n",
+ LCONSOLE_ERROR_MSG(0x16a, "Server %s version (%d.%d.%d.%d) refused connection from this client with an incompatible version (%s). Client must be recompiled\n",
obd2cli_tgt(imp->imp_obd),
OBD_OCD_VERSION_MAJOR(ocd->ocd_version),
OBD_OCD_VERSION_MINOR(ocd->ocd_version),
"%s: version recovery fails, reconnecting\n",
req->rq_import->imp_obd->obd_name);
} else {
- CDEBUG(D_HA, "%s: LAST_REPLAY message error: %d, "
- "reconnecting\n",
+ CDEBUG(D_HA, "%s: LAST_REPLAY message error: %d, reconnecting\n",
req->rq_import->imp_obd->obd_name,
req->rq_status);
}
static int signal_completed_replay(struct obd_import *imp)
{
struct ptlrpc_request *req;
+
ENTRY;
if (unlikely(CFS_FAIL_CHECK(OBD_FAIL_PTLRPC_FINISH_REPLAY)))
*/
int ptlrpc_import_recovery_state_machine(struct obd_import *imp)
{
- int rc = 0;
- int inflight;
- char *target_start;
- int target_len;
+ int rc = 0;
+ int inflight;
+ char *target_start;
+ int target_len;
- ENTRY;
- if (imp->imp_state == LUSTRE_IMP_EVICTED) {
+ ENTRY;
+ if (imp->imp_state == LUSTRE_IMP_EVICTED) {
struct task_struct *task;
u64 connect_flags;
- deuuidify(obd2cli_tgt(imp->imp_obd), NULL,
- &target_start, &target_len);
+ deuuidify(obd2cli_tgt(imp->imp_obd), NULL,
+ &target_start, &target_len);
connect_flags = imp->imp_connect_data.ocd_connect_flags;
- /* Don't care about MGC eviction */
- if (strcmp(imp->imp_obd->obd_type->typ_name,
- LUSTRE_MGC_NAME) != 0 &&
+ /* Don't care about MGC eviction */
+ if (strcmp(imp->imp_obd->obd_type->typ_name,
+ LUSTRE_MGC_NAME) != 0 &&
(connect_flags & OBD_CONNECT_LIGHTWEIGHT) == 0) {
- LCONSOLE_ERROR_MSG(0x167, "%s: This client was evicted "
- "by %.*s; in progress operations "
- "using this service will fail.\n",
+ LCONSOLE_ERROR_MSG(0x167, "%s: This client was evicted by %.*s; in progress operations using this service will fail.\n",
imp->imp_obd->obd_name, target_len,
target_start);
LASSERTF(!obd_lbug_on_eviction, "LBUG upon eviction\n");
- }
- CDEBUG(D_HA, "evicted from %s@%s; invalidating\n",
- obd2cli_tgt(imp->imp_obd),
- imp->imp_connection->c_remote_uuid.uuid);
- /* reset vbr_failed flag upon eviction */
+ }
+ CDEBUG(D_HA, "evicted from %s@%s; invalidating\n",
+ obd2cli_tgt(imp->imp_obd),
+ imp->imp_connection->c_remote_uuid.uuid);
+ /* reset vbr_failed flag upon eviction */
spin_lock(&imp->imp_lock);
imp->imp_vbr_failed = 0;
spin_unlock(&imp->imp_lock);
/* bug 17802: XXX client_disconnect_export vs connect request
* race. if client is evicted at this time then we start
* invalidate thread without reference to import and import can
- * be freed at same time. */
+ * be freed at same time.
+ */
class_import_get(imp);
task = kthread_run(ptlrpc_invalidate_import_thread, imp,
"ll_imp_inval");
rc = 0;
}
RETURN(rc);
- }
+ }
if (imp->imp_state == LUSTRE_IMP_REPLAY) {
CDEBUG(D_HA, "replay requested by %s\n",
}
if (imp->imp_state == LUSTRE_IMP_REPLAY_WAIT) {
- if (atomic_read(&imp->imp_replay_inflight) == 0) {
+ if (atomic_read(&imp->imp_replay_inflight) == 0)
import_set_state(imp, LUSTRE_IMP_RECOVER);
- }
}
if (imp->imp_state == LUSTRE_IMP_RECOVER) {
{
struct ptlrpc_request *req;
int rq_opc, rc = 0;
+
ENTRY;
switch (imp->imp_connect_op) {
break;
default:
rc = -EINVAL;
- CERROR("%s: don't know how to disconnect from %s "
- "(connect_op %d): rc = %d\n",
+ CERROR("%s: don't know how to disconnect from %s (connect_op %d): rc = %d\n",
imp->imp_obd->obd_name, obd2cli_tgt(imp->imp_obd),
imp->imp_connect_op, rc);
RETURN(ERR_PTR(rc));
/* We are disconnecting, do not retry a failed DISCONNECT rpc if
* it fails. We can get through the above with a down server
- * if the client doesn't know the server is gone yet. */
+ * if the client doesn't know the server is gone yet.
+ */
req->rq_no_resend = 1;
- /* We want client umounts to happen quickly, no matter the
- server state... */
+ /* We want client umounts to happen quickly, no matter server state */
req->rq_timeout = min_t(timeout_t, req->rq_timeout,
INITIAL_CONNECT_TIMEOUT);
{
struct ptlrpc_request *req;
int rc = 0;
+
ENTRY;
if (imp->imp_obd->obd_force)
struct ptlrpc_request *old, *tmp;
/* tag all resendable requests generated before disconnection
- * notice this code is part of disconnect-at-idle path only */
+ * notice this code is part of disconnect-at-idle path only
+ */
list_for_each_entry_safe(old, tmp, &imp->imp_delayed_list,
rq_list) {
spin_lock(&old->rq_lock);
spin_lock(&imp->imp_lock);
/* DISCONNECT reply can be late and another connection can just
- * be initiated. so we have to abort disconnection. */
+ * be initiated. so we have to abort disconnection.
+ */
if (req->rq_import_generation == imp->imp_generation &&
imp->imp_state != LUSTRE_IMP_CLOSED) {
LASSERTF(imp->imp_state == LUSTRE_IMP_CONNECTING,
int ptlrpc_disconnect_and_idle_import(struct obd_import *imp)
{
struct ptlrpc_request *req;
+
ENTRY;
if (imp->imp_obd->obd_force)
at->at_hist[0] = max_t(timeout_t, timeout, at->at_hist[0]);
at->at_current_timeout = max_t(timeout_t, timeout,
at->at_current_timeout);
- } else {
+ } else {
int i, shift;
timeout_t maxv = timeout;
/* Find the imp_at index for a given portal; assign if space available */
int import_at_get_index(struct obd_import *imp, int portal)
{
- struct imp_at *at = &imp->imp_at;
- int i;
-
- for (i = 0; i < IMP_AT_MAX_PORTALS; i++) {
- if (at->iat_portal[i] == portal)
- return i;
- if (at->iat_portal[i] == 0)
- /* unused */
- break;
- }
-
- /* Not found in list, add it under a lock */
+ struct imp_at *at = &imp->imp_at;
+ int i;
+
+ for (i = 0; i < IMP_AT_MAX_PORTALS; i++) {
+ if (at->iat_portal[i] == portal)
+ return i;
+ if (at->iat_portal[i] == 0)
+ /* unused */
+ break;
+ }
+
+ /* Not found in list, add it under a lock */
spin_lock(&imp->imp_lock);
- /* Check unused under lock */
- for (; i < IMP_AT_MAX_PORTALS; i++) {
- if (at->iat_portal[i] == portal)
- goto out;
- if (at->iat_portal[i] == 0)
- /* unused */
- break;
- }
+ /* Check unused under lock */
+ for (; i < IMP_AT_MAX_PORTALS; i++) {
+ if (at->iat_portal[i] == portal)
+ goto out;
+ if (at->iat_portal[i] == 0)
+ /* unused */
+ break;
+ }
- /* Not enough portals? */
- LASSERT(i < IMP_AT_MAX_PORTALS);
+ /* Not enough portals? */
+ LASSERT(i < IMP_AT_MAX_PORTALS);
- at->iat_portal[i] = portal;
+ at->iat_portal[i] = portal;
out:
spin_unlock(&imp->imp_lock);
return i;