#define MGC_ENQUEUE_LIMIT (INITIAL_CONNECT_TIMEOUT + (AT_OFF ? 0 : at_min) \
+ PING_INTERVAL)
#define MGC_TARGET_REG_LIMIT 10
+#define MGC_TARGET_REG_LIMIT_MAX RECONNECT_DELAY_MAX
#define MGC_SEND_PARAM_LIMIT 10
#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0)
RETURN(-ENOMEM);
}
- memcpy(req_mti, mti, sizeof(*req_mti));
- ptlrpc_request_set_replen(req);
- CDEBUG(D_MGC, "register %s\n", mti->mti_svname);
- /* Limit how long we will wait for the enqueue to complete */
- req->rq_delay_limit = MGC_TARGET_REG_LIMIT;
+ memcpy(req_mti, mti, sizeof(*req_mti));
+ ptlrpc_request_set_replen(req);
+ CDEBUG(D_MGC, "register %s\n", mti->mti_svname);
+ /* Limit how long we will wait for the enqueue to complete */
+ req->rq_delay_limit = MGC_TARGET_REG_LIMIT;
+
+ /* if the target needs to regenerate the config log in MGS, it's better
+ * to use some longer limit to let MGC have time to change connection to
+ * another MGS (or try again with the same MGS) for the target (server)
+ * will fail and exit if the request expired due to delay limit. */
+ if (mti->mti_flags & (LDD_F_UPDATE | LDD_F_NEED_INDEX))
+ req->rq_delay_limit = MGC_TARGET_REG_LIMIT_MAX;
rc = ptlrpc_queue_wait(req);
if (!rc) {
int rc = -EINVAL;
ENTRY;
- /* Turn off initial_recov after we try all backup servers once */
- if (KEY_IS(KEY_INIT_RECOV_BACKUP)) {
- struct obd_import *imp = class_exp2cliimp(exp);
- int value;
- if (vallen != sizeof(int))
- RETURN(-EINVAL);
- value = *(int *)val;
- CDEBUG(D_MGC, "InitRecov %s %d/d%d:i%d:r%d:or%d:%s\n",
- imp->imp_obd->obd_name, value,
- imp->imp_deactive, imp->imp_invalid,
- imp->imp_replayable, imp->imp_obd->obd_replayable,
- ptlrpc_import_state_name(imp->imp_state));
- /* Resurrect if we previously died */
- if ((imp->imp_state != LUSTRE_IMP_FULL &&
- imp->imp_state != LUSTRE_IMP_NEW) || value > 1)
- ptlrpc_reconnect_import(imp);
- RETURN(0);
- }
+ /* Turn off initial_recov after we try all backup servers once */
+ if (KEY_IS(KEY_INIT_RECOV_BACKUP)) {
+ struct obd_import *imp = class_exp2cliimp(exp);
+ int value;
+ if (vallen != sizeof(int))
+ RETURN(-EINVAL);
+ value = *(int *)val;
+ CDEBUG(D_MGC, "InitRecov %s %d/d%d:i%d:r%d:or%d:%s\n",
+ imp->imp_obd->obd_name, value,
+ imp->imp_deactive, imp->imp_invalid,
+ imp->imp_replayable, imp->imp_obd->obd_replayable,
+ ptlrpc_import_state_name(imp->imp_state));
+ /* Resurrect the import immediately if
+ * 1. we previously got disconnected,
+ * 2. value > 1 (at the same node with MGS)
+ * */
+ if (imp->imp_state == LUSTRE_IMP_DISCON || value > 1)
+ ptlrpc_reconnect_import(imp);
+
+ RETURN(0);
+ }
+
/* FIXME move this to mgc_process_config */
if (KEY_IS(KEY_REGISTER_TARGET)) {
struct mgs_target_info *mti;