From 00ffad7af3bc7295797efd21eb16e7deaa715f45 Mon Sep 17 00:00:00 2001 From: Mikhail Pershin Date: Thu, 20 Aug 2015 21:59:02 +0300 Subject: [PATCH] LU-8089 lwp: change lwp export only at first connect Fix lwp connection logic, change export only at first connection. Signed-off-by: Mikhail Pershin Change-Id: I5b528c2f6d142b8cfdd8d84f3f540289e45d557f Reviewed-on: http://review.whamcloud.com/13726 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- lustre/ldlm/ldlm_lib.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 680a03f..65b177b 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -952,7 +952,7 @@ int target_handle_connect(struct ptlrpc_request *req) int rc = 0; char *target_start; int target_len; - bool mds_conn = false, lw_client = false; + bool mds_conn = false, lw_client = false, initial_conn = false; bool mds_mds_conn = false; bool new_mds_mds_conn = false; bool target_referenced = false; @@ -1084,6 +1084,7 @@ int target_handle_connect(struct ptlrpc_request *req) lw_client = (data->ocd_connect_flags & OBD_CONNECT_LIGHTWEIGHT) != 0; if (lustre_msg_get_op_flags(req->rq_reqmsg) & MSG_CONNECT_INITIAL) { + initial_conn = true; mds_conn = (data->ocd_connect_flags & OBD_CONNECT_MDS) != 0; mds_mds_conn = (data->ocd_connect_flags & OBD_CONNECT_MDS_MDS) != 0; @@ -1141,8 +1142,8 @@ int target_handle_connect(struct ptlrpc_request *req) class_export_put(export); export = NULL; rc = -EALREADY; - } else if ((mds_conn || lw_client || - data->ocd_connect_flags & OBD_CONNECT_MDS_MDS) && + } else if ((mds_conn || (lw_client && initial_conn) || + data->ocd_connect_flags & OBD_CONNECT_MDS_MDS) && export->exp_connection != NULL) { spin_unlock(&export->exp_lock); if (req->rq_peer.nid != export->exp_connection->c_peer.nid) { @@ -1178,10 +1179,8 @@ int target_handle_connect(struct ptlrpc_request *req) export = NULL; rc = 0; } - } else if (export->exp_connection != NULL && - req->rq_peer.nid != export->exp_connection->c_peer.nid && - (lustre_msg_get_op_flags(req->rq_reqmsg) & - MSG_CONNECT_INITIAL)) { + } else if (export->exp_connection != NULL && initial_conn && + req->rq_peer.nid != export->exp_connection->c_peer.nid) { spin_unlock(&export->exp_lock); /* In MDS failover we have static UUID but NID can change. */ LCONSOLE_WARN("%s: Client %s seen on new nid %s when " -- 1.8.3.1