From 34a9bf694a584437e4bf7a037dea32a6271e93d3 Mon Sep 17 00:00:00 2001 From: Mikhail Pershin Date: Tue, 3 Dec 2013 17:30:15 +0400 Subject: [PATCH] LU-4214 target: LWP failover should create new export Upon reconnection from new NID LWP client need to create new export and destroy old one like that is done for MDS connection Signed-off-by: Mikhail Pershin Change-Id: Id21a742a978f629e2324bc568a1a50c2922fe3cc Reviewed-on: http://review.whamcloud.com/8465 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Niu Yawei Reviewed-by: Johann Lombardi --- lustre/ldlm/ldlm_lib.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index a3769d5..c5067ad 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -908,12 +908,11 @@ int target_handle_connect(struct ptlrpc_request *req) } } - if ((lustre_msg_get_op_flags(req->rq_reqmsg) & MSG_CONNECT_INITIAL) && - (data->ocd_connect_flags & OBD_CONNECT_MDS)) - mds_conn = true; - - if ((data->ocd_connect_flags & OBD_CONNECT_LIGHTWEIGHT) != 0) - lw_client = true; + if (lustre_msg_get_op_flags(req->rq_reqmsg) & MSG_CONNECT_INITIAL) { + mds_conn = (data->ocd_connect_flags & OBD_CONNECT_MDS) != 0; + lw_client = (data->ocd_connect_flags & + OBD_CONNECT_LIGHTWEIGHT) != 0; + } /* lctl gets a backstage, all-access pass. */ if (obd_uuid_equals(&cluuid, &target->obd_uuid)) @@ -935,19 +934,21 @@ int target_handle_connect(struct ptlrpc_request *req) class_export_put(export); export = NULL; rc = -EALREADY; - } else if (mds_conn && export->exp_connection) { + } else if ((mds_conn || lw_client) && export->exp_connection != NULL) { spin_unlock(&export->exp_lock); - if (req->rq_peer.nid != export->exp_connection->c_peer.nid) - /* MDS reconnected after failover. */ - LCONSOLE_WARN("%s: Received MDS connection from " + if (req->rq_peer.nid != export->exp_connection->c_peer.nid) + /* MDS or LWP reconnected after failover. */ + LCONSOLE_WARN("%s: Received %s connection from " "%s, removing former export from %s\n", - target->obd_name, libcfs_nid2str(req->rq_peer.nid), + target->obd_name, mds_conn ? "MDS" : "LWP", + libcfs_nid2str(req->rq_peer.nid), libcfs_nid2str(export->exp_connection->c_peer.nid)); else /* New MDS connection from the same NID. */ - LCONSOLE_WARN("%s: Received new MDS connection from " - "%s, removing former export from same NID\n", - target->obd_name, libcfs_nid2str(req->rq_peer.nid)); + LCONSOLE_WARN("%s: Received new %s connection from " + "%s, removing former export from same NID\n", + target->obd_name, mds_conn ? "MDS" : "LWP", + libcfs_nid2str(req->rq_peer.nid)); class_fail_export(export); class_export_put(export); export = NULL; -- 1.8.3.1