- rc = ptlrpc_import_recovery_state_machine(imp);
- if (rc != 0) {
- if (rc == -ENOTCONN) {
- CDEBUG(D_HA, "evicted/aborted by %s@%s during recovery;"
- "invalidating and reconnecting\n",
- obd2cli_tgt(imp->imp_obd),
- imp->imp_connection->c_remote_uuid.uuid);
- ptlrpc_connect_import(imp, NULL);
- RETURN(0);
- }
- } else {
- struct obd_connect_data *ocd;
- struct obd_export *exp;
- int ret;
- ret = req_capsule_get_size(&request->rq_pill, &RMF_CONNECT_DATA,
- RCL_SERVER);
- /* server replied obd_connect_data is always bigger */
- ocd = req_capsule_server_sized_get(&request->rq_pill,
- &RMF_CONNECT_DATA, ret);
-
- cfs_spin_lock(&imp->imp_lock);
- cfs_list_del(&imp->imp_conn_current->oic_item);
- cfs_list_add(&imp->imp_conn_current->oic_item,
- &imp->imp_conn_list);
- imp->imp_last_success_conn =
- imp->imp_conn_current->oic_last_attempt;
-
- if (ocd == NULL) {
- cfs_spin_unlock(&imp->imp_lock);
- CERROR("Wrong connect data from server\n");
- rc = -EPROTO;
- GOTO(out, rc);
- }
-
- imp->imp_connect_data = *ocd;
-
- exp = class_conn2export(&imp->imp_dlm_handle);
- cfs_spin_unlock(&imp->imp_lock);
-
- /* check that server granted subset of flags we asked for. */
- LASSERTF((ocd->ocd_connect_flags &
- imp->imp_connect_flags_orig) ==
- ocd->ocd_connect_flags, LPX64" != "LPX64,
- imp->imp_connect_flags_orig, ocd->ocd_connect_flags);
-
- if (!exp) {
- /* This could happen if export is cleaned during the
- connect attempt */
- CERROR("Missing export for %s\n",
- imp->imp_obd->obd_name);
- GOTO(out, rc = -ENODEV);
- }
- old_connect_flags = exp->exp_connect_flags;
- exp->exp_connect_flags = ocd->ocd_connect_flags;
- imp->imp_obd->obd_self_export->exp_connect_flags =
- ocd->ocd_connect_flags;
- class_export_put(exp);
-
- obd_import_event(imp->imp_obd, imp, IMP_EVENT_OCD);
-
- if (!ocd->ocd_ibits_known &&
- ocd->ocd_connect_flags & OBD_CONNECT_IBITS)
- CERROR("Inodebits aware server returned zero compatible"
- " bits?\n");
-
- if ((ocd->ocd_connect_flags & OBD_CONNECT_VERSION) &&
- (ocd->ocd_version > LUSTRE_VERSION_CODE +
- 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 */
+ rc = ptlrpc_import_recovery_state_machine(imp);
+ if (rc != 0) {
+ if (rc == -ENOTCONN) {
+ CDEBUG(D_HA, "evicted/aborted by %s@%s during recovery;"
+ "invalidating and reconnecting\n",
+ obd2cli_tgt(imp->imp_obd),
+ imp->imp_connection->c_remote_uuid.uuid);
+ ptlrpc_connect_import(imp);
+ imp->imp_connect_tried = 1;
+ RETURN(0);
+ }
+ } else {
+ static bool warned;
+
+ spin_lock(&imp->imp_lock);
+ cfs_list_del(&imp->imp_conn_current->oic_item);
+ cfs_list_add(&imp->imp_conn_current->oic_item,
+ &imp->imp_conn_list);
+ imp->imp_last_success_conn =
+ imp->imp_conn_current->oic_last_attempt;
+
+ spin_unlock(&imp->imp_lock);
+
+ if ((imp->imp_connect_flags_orig & OBD_CONNECT_IBITS) &&
+ !(ocd->ocd_connect_flags & OBD_CONNECT_IBITS)) {
+ LCONSOLE_WARN("%s: MDS %s does not support ibits "
+ "lock, either very old or invalid: "
+ "requested "LPX64", replied "LPX64"\n",
+ imp->imp_obd->obd_name,
+ imp->imp_connection->c_remote_uuid.uuid,
+ imp->imp_connect_flags_orig,
+ ocd->ocd_connect_flags);
+ GOTO(out, rc = -EPROTO);
+ }
+
+ if (!warned && (ocd->ocd_connect_flags & OBD_CONNECT_VERSION) &&
+ (ocd->ocd_version > LUSTRE_VERSION_CODE +
+ 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";