From d10320bafdb942a8dbc5a8ba9176873134a5ffa3 Mon Sep 17 00:00:00 2001 From: Mikhal Pershin Date: Mon, 4 Apr 2016 13:56:35 +0300 Subject: [PATCH] LU-7558 import: don't reconnect during connect interpret The import connect flags might be cleared by ptlrpc_connect_import() wrongly if there is still connect interpret function is running. Use imp_connected boolean variable to indicate that we are still interpretting connect reply and don't try to reconnect until it ends. Signed-off-by: Mikhal Pershin Change-Id: I77cf70820835dc06b33a75353c8ef71ba4ed4fad Reviewed-on: http://review.whamcloud.com/19312 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- lustre/include/lustre_import.h | 4 +++- lustre/ptlrpc/import.c | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lustre/include/lustre_import.h b/lustre/include/lustre_import.h index e064c05..6bc308d 100644 --- a/lustre/include/lustre_import.h +++ b/lustre/include/lustre_import.h @@ -309,7 +309,9 @@ struct obd_import { * chouse new connection */ imp_force_reconnect:1, /* import has tried to connect with server */ - imp_connect_tried:1; + imp_connect_tried:1, + /* connected but not FULL yet */ + imp_connected:1; __u32 imp_connect_op; struct obd_connect_data imp_connect_data; __u64 imp_connect_flags_orig; diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index 78dc51b..94e5908 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -670,7 +670,8 @@ int ptlrpc_connect_import(struct obd_import *imp) spin_unlock(&imp->imp_lock); CERROR("already connected\n"); RETURN(0); - } else if (imp->imp_state == LUSTRE_IMP_CONNECTING) { + } else if (imp->imp_state == LUSTRE_IMP_CONNECTING || + imp->imp_connected) { spin_unlock(&imp->imp_lock); CERROR("already connecting\n"); RETURN(-EALREADY); @@ -1009,11 +1010,16 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, ptlrpc_maybe_ping_import_soon(imp); GOTO(out, rc); } + + /* LU-7558: indicate that we are interpretting connect reply, + * pltrpc_connect_import() will not try to reconnect until + * interpret will finish. */ + imp->imp_connected = 1; spin_unlock(&imp->imp_lock); - LASSERT(imp->imp_conn_current); + LASSERT(imp->imp_conn_current); - msg_flags = lustre_msg_get_op_flags(request->rq_repmsg); + msg_flags = lustre_msg_get_op_flags(request->rq_repmsg); ret = req_capsule_get_size(&request->rq_pill, &RMF_CONNECT_DATA, RCL_SERVER); @@ -1258,12 +1264,18 @@ finish: obd2cli_tgt(imp->imp_obd), imp->imp_connection->c_remote_uuid.uuid); ptlrpc_connect_import(imp); + spin_lock(&imp->imp_lock); + imp->imp_connected = 0; imp->imp_connect_tried = 1; + spin_unlock(&imp->imp_lock); RETURN(0); } out: + spin_lock(&imp->imp_lock); + imp->imp_connected = 0; imp->imp_connect_tried = 1; + spin_unlock(&imp->imp_lock); if (rc != 0) { IMPORT_SET_STATE(imp, LUSTRE_IMP_DISCON); -- 1.8.3.1