int rc = 0;
struct ptlrpc_request *req = NULL;
__u64 last_transno;
- ENTRY;
+ ENTRY;
*inflight = 0;
/* It might have committed some after we last spoke, so make sure we
}
/* All the requests in committed list have been replayed, let's replay
- * the imp_replay_list */
+ * the imp_replay_list
+ */
if (req == NULL) {
struct ptlrpc_request *tmp;
/* If need to resend the last sent transno (because a reconnect
* has occurred), then stop on the matching req and send it again.
* If, however, the last sent transno has been committed then we
- * continue replay from the next request. */
+ * continue replay from the next request.
+ */
if (req != NULL && imp->imp_resend_replay)
lustre_msg_add_flags(req->rq_reqmsg, MSG_RESENT);
/* ptlrpc_prepare_replay() may fail to add the reqeust into unreplied
* list if the request hasn't been added to replay list then. Another
* exception is that resend replay could have been removed from the
- * unreplied list. */
+ * unreplied list.
+ */
if (req != NULL && list_empty(&req->rq_unreplied_list)) {
DEBUG_REQ(D_HA, req, "resend_replay=%d, last_transno=%llu",
imp->imp_resend_replay, last_transno);
{
struct ptlrpc_request *req;
- ENTRY;
+ ENTRY;
- /* As long as we're in recovery, nothing should be added to the sending
- * list, so we don't need to hold the lock during this iteration and
- * resend process.
- */
- /* Well... what if lctl recover is called twice at the same time?
- */
+ /* As long as we're in recovery, nothing should be added to the sending
+ * list, so we don't need to hold the lock during this iteration and
+ * resend process.
+ *
+ * Well... what if lctl recover is called twice at the same time?
+ */
spin_lock(&imp->imp_lock);
if (imp->imp_state != LUSTRE_IMP_RECOVER) {
spin_unlock(&imp->imp_lock);
- RETURN(-1);
- }
+ RETURN(-1);
+ }
list_for_each_entry(req, &imp->imp_sending_list, rq_list) {
LASSERTF((long)req > PAGE_SIZE && req != LP_POISON,
LASSERTF(req->rq_type != LI_POISON, "req %px freed\n", req);
/* If the request is allowed to be sent during replay and it
- * is not timeout yet, then it does not need to be resent. */
+ * is not timeout yet, then it does not need to be resent.
+ */
if (!ptlrpc_no_resend(req) &&
(req->rq_timedout || !req->rq_allow_replay))
ptlrpc_resend_req(req);
{
struct obd_import *imp = failed_req->rq_import;
int conn = lustre_msg_get_conn_cnt(failed_req->rq_reqmsg);
- ENTRY;
+ 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);
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;
*/
int ptlrpc_set_import_active(struct obd_import *imp, int active)
{
- struct obd_device *obd = imp->imp_obd;
- int rc = 0;
+ struct obd_device *obd = imp->imp_obd;
+ int rc = 0;
- ENTRY;
- LASSERT(obd);
+ ENTRY;
+ LASSERT(obd);
- /* When deactivating, mark import invalid, and abort in-flight
- * requests. */
- if (!active) {
- LCONSOLE_WARN("setting import %s INACTIVE by administrator "
- "request\n", obd2cli_tgt(imp->imp_obd));
+ /* When deactivating, mark import invalid, & abort in-flight requests */
+ if (!active) {
+ LCONSOLE_WARN("setting import %s INACTIVE by administrator request\n",
+ obd2cli_tgt(imp->imp_obd));
- /* set before invalidate to avoid messages about imp_inval
- * set without imp_deactive in ptlrpc_import_delay_req */
+ /* set before invalidate to avoid messages about imp_inval
+ * set without imp_deactive in ptlrpc_import_delay_req
+ */
spin_lock(&imp->imp_lock);
imp->imp_deactive = 1;
spin_unlock(&imp->imp_lock);
- obd_import_event(imp->imp_obd, imp, IMP_EVENT_DEACTIVATE);
+ obd_import_event(imp->imp_obd, imp, IMP_EVENT_DEACTIVATE);
- ptlrpc_invalidate_import(imp);
- }
+ ptlrpc_invalidate_import(imp);
+ }
- /* When activating, mark import valid, and attempt recovery */
- if (active) {
- CDEBUG(D_HA, "setting import %s VALID\n",
- obd2cli_tgt(imp->imp_obd));
+ /* When activating, mark import valid, and attempt recovery */
+ if (active) {
+ CDEBUG(D_HA, "setting import %s VALID\n",
+ obd2cli_tgt(imp->imp_obd));
spin_lock(&imp->imp_lock);
imp->imp_deactive = 0;
spin_unlock(&imp->imp_lock);
- obd_import_event(imp->imp_obd, imp, IMP_EVENT_ACTIVATE);
+ obd_import_event(imp->imp_obd, imp, IMP_EVENT_ACTIVATE);
- rc = ptlrpc_recover_import(imp, NULL, 0);
- }
+ rc = ptlrpc_recover_import(imp, NULL, 0);
+ }
- RETURN(rc);
+ RETURN(rc);
}
EXPORT_SYMBOL(ptlrpc_set_import_active);
return in_recovery;
}
-
/* Attempt to reconnect an import */
int ptlrpc_recover_import(struct obd_import *imp, char *new_uuid, int async)
{
int rc = 0;
- ENTRY;
+ ENTRY;
spin_lock(&imp->imp_lock);
if (imp->imp_state == LUSTRE_IMP_NEW || imp->imp_deactive ||
atomic_read(&imp->imp_inval_count))