* exception is that resend replay could have been removed from the
* unreplied list. */
if (req != NULL && list_empty(&req->rq_unreplied_list)) {
- DEBUG_REQ(D_HA, req, "resend_replay: %d, last_transno: %llu\n",
+ DEBUG_REQ(D_HA, req, "resend_replay=%d, last_transno=%llu",
imp->imp_resend_replay, last_transno);
ptlrpc_add_unreplied(req);
imp->imp_known_replied_xid = ptlrpc_known_replied_xid(imp);
void ptlrpc_request_handle_notconn(struct ptlrpc_request *failed_req)
{
- struct obd_import *imp = failed_req->rq_import;
- ENTRY;
+ struct obd_import *imp = failed_req->rq_import;
+ int conn = lustre_msg_get_conn_cnt(failed_req->rq_reqmsg);
+ ENTRY;
- CDEBUG(D_HA, "import %s of %s@%s abruptly disconnected: reconnecting\n",
- imp->imp_obd->obd_name, obd2cli_tgt(imp->imp_obd),
- imp->imp_connection->c_remote_uuid.uuid);
-
- if (ptlrpc_set_import_discon(imp,
- lustre_msg_get_conn_cnt(failed_req->rq_reqmsg))) {
- if (!imp->imp_replayable) {
- 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);
- ptlrpc_deactivate_import(imp);
- }
- /* to control recovery via lctl {disable|enable}_recovery */
- if (imp->imp_deactive == 0)
- ptlrpc_connect_import(imp);
- }
+ CDEBUG(D_HA, "import %s of %s@%s abruptly disconnected: reconnecting\n",
+ imp->imp_obd->obd_name, obd2cli_tgt(imp->imp_obd),
+ imp->imp_connection->c_remote_uuid.uuid);
+
+ if (ptlrpc_set_import_discon(imp, conn, true)) {
+ /* to control recovery via lctl {disable|enable}_recovery */
+ if (imp->imp_deactive == 0)
+ ptlrpc_connect_import(imp);
+ }
- /* Wait for recovery to complete and resend. If evicted, then
- this request will be errored out later.*/
+ /* Wait for recovery to complete and resend. If evicted, then
+ this request will be errored out later.*/
spin_lock(&failed_req->rq_lock);
if (!failed_req->rq_no_resend)
failed_req->rq_resend = 1;
}
/**
- * Administratively active/deactive a client.
+ * Administratively active/deactive a client.
* This should only be called by the ioctl interface, currently
* - the lctl deactivate and activate commands
* - echo 0/1 >> /proc/osc/XXX/active
atomic_read(&imp->imp_inval_count))
rc = -EINVAL;
spin_unlock(&imp->imp_lock);
- if (rc)
- GOTO(out, rc);
+ if (rc)
+ GOTO(out, rc);
- /* force import to be disconnected. */
- ptlrpc_set_import_discon(imp, 0);
+ /* force import to be disconnected. */
+ ptlrpc_set_import_discon(imp, 0, false);
- if (new_uuid) {
- struct obd_uuid uuid;
+ if (new_uuid) {
+ struct obd_uuid uuid;
- /* intruct import to use new uuid */
- obd_str2uuid(&uuid, new_uuid);
- rc = import_set_conn_priority(imp, &uuid);
- if (rc)
- GOTO(out, rc);
- }
+ /* intruct import to use new uuid */
+ obd_str2uuid(&uuid, new_uuid);
+ rc = import_set_conn_priority(imp, &uuid);
+ if (rc)
+ GOTO(out, rc);
+ }
- /* Check if reconnect is already in progress */
+ /* Check if reconnect is already in progress */
spin_lock(&imp->imp_lock);
if (imp->imp_state != LUSTRE_IMP_DISCON) {
imp->imp_force_verify = 1;
rc = -EALREADY;
}
spin_unlock(&imp->imp_lock);
- if (rc)
- GOTO(out, rc);
-
- rc = ptlrpc_connect_import(imp);
- if (rc)
- GOTO(out, rc);
-
- if (!async) {
- struct l_wait_info lwi;
- long secs = cfs_time_seconds(obd_timeout);
-
- CDEBUG(D_HA, "%s: recovery started, waiting %lu seconds\n",
- obd2cli_tgt(imp->imp_obd), secs);
-
- lwi = LWI_TIMEOUT(secs, NULL, NULL);
- rc = l_wait_event(imp->imp_recovery_waitq,
- !ptlrpc_import_in_recovery(imp), &lwi);
- CDEBUG(D_HA, "%s: recovery finished\n",
- obd2cli_tgt(imp->imp_obd));
- }
- EXIT;
+ if (rc)
+ GOTO(out, rc);
+
+ OBD_RACE(OBD_FAIL_PTLRPC_CONNECT_RACE);
+
+ rc = ptlrpc_connect_import(imp);
+ if (rc)
+ GOTO(out, rc);
+
+ if (!async) {
+ long timeout = cfs_time_seconds(obd_timeout);
+
+ CDEBUG(D_HA, "%s: recovery started, waiting %u jiffies\n",
+ obd2cli_tgt(imp->imp_obd), obd_timeout);
+
+ rc = wait_event_idle_timeout(imp->imp_recovery_waitq,
+ !ptlrpc_import_in_recovery(imp),
+ timeout);
+ if (rc == 0)
+ rc = -ETIMEDOUT;
+ else
+ rc = 0;
+ CDEBUG(D_HA, "%s: recovery finished\n",
+ obd2cli_tgt(imp->imp_obd));
+ }
+ EXIT;
out:
- return rc;
+ return rc;
}
EXPORT_SYMBOL(ptlrpc_recover_import);
int in_recovery = 1;
spin_lock(&imp->imp_lock);
- if (imp->imp_state == LUSTRE_IMP_FULL ||
- imp->imp_state == LUSTRE_IMP_CLOSED ||
- imp->imp_state == LUSTRE_IMP_DISCON ||
+ if (imp->imp_state <= LUSTRE_IMP_DISCON ||
+ imp->imp_state >= LUSTRE_IMP_FULL ||
imp->imp_obd->obd_no_recov)
in_recovery = 0;
spin_unlock(&imp->imp_lock);