From b9b9046f69e658c9fcd053be7d6ee045f0d495b9 Mon Sep 17 00:00:00 2001 From: johann Date: Fri, 6 Mar 2009 14:29:11 +0000 Subject: [PATCH] Branch HEAD b=18558 i=shadow i=tappro - check for exp->exp_connecting even for the initial mds connection - fix debug message if the initial connect comes from the same nid (MDS has been rebooted). --- lustre/ldlm/ldlm_lib.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 8687129..dc1c7e2 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -740,24 +740,33 @@ int target_handle_connect(struct ptlrpc_request *req) goto dont_check_exports; export = lustre_hash_lookup(target->obd_uuid_hash, &cluuid); + if (!export) + goto no_export; - if (export != NULL && mds_conn) { - /* mds reconnected after failover */ - class_fail_export(export); - CWARN("%s: received MDS connection from NID %s," - " removing former export from NID %s\n", - target->obd_name, libcfs_nid2str(req->rq_peer.nid), - libcfs_nid2str(export->exp_connection->c_peer.nid)); - class_export_put(export); - export = NULL; - rc = 0; - } else if (export != NULL && export->exp_connecting) { /* bug 9635, et. al. */ + /* we've found an export in the hash */ + if (export->exp_connecting) { /* bug 9635, et. al. */ CWARN("%s: exp %p already connecting\n", export->exp_obd->obd_name, export); class_export_put(export); export = NULL; rc = -EALREADY; - } else if (export != NULL && export->exp_connection != NULL && + } else if (mds_conn && export->exp_connection) { + if (req->rq_peer.nid != export->exp_connection->c_peer.nid) + /* mds reconnected after failover */ + CWARN("%s: received MDS connection from NID %s," + " removing former export from NID %s\n", + target->obd_name, libcfs_nid2str(req->rq_peer.nid), + libcfs_nid2str(export->exp_connection->c_peer.nid)); + else + /* new mds connection from the same nid */ + CWARN("%s: received new MDS connection from NID %s," + " removing former export from same NID\n", + target->obd_name, libcfs_nid2str(req->rq_peer.nid)); + class_fail_export(export); + class_export_put(export); + export = NULL; + rc = 0; + } else if (export->exp_connection != NULL && req->rq_peer.nid != export->exp_connection->c_peer.nid) { /* in mds failover we have static uuid but nid can be * changed*/ @@ -769,7 +778,7 @@ int target_handle_connect(struct ptlrpc_request *req) rc = -EALREADY; class_export_put(export); export = NULL; - } else if (export != NULL) { + } else { spin_lock(&export->exp_lock); export->exp_connecting = 1; spin_unlock(&export->exp_lock); @@ -781,6 +790,7 @@ int target_handle_connect(struct ptlrpc_request *req) /* If we found an export, we already unlocked. */ if (!export) { +no_export: OBD_FAIL_TIMEOUT(OBD_FAIL_TGT_DELAY_CONNECT, 2 * obd_timeout); } else if (req->rq_export == NULL && atomic_read(&export->exp_rpc_count) > 0) { -- 1.8.3.1