From 3cadd5d8bdedef530043f8605ae23ce28ec0a40c Mon Sep 17 00:00:00 2001 From: Dmitry Zogin Date: Fri, 7 May 2010 20:20:02 -0400 Subject: [PATCH] b=22656 Prevent failover nids from registering with MGS first. Make the check in mgs_handle_target_reg() o=Joseph Herring i=nathan.rutman i=andreas.dilger --- lustre/mgs/mgs_handler.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c index f8b7892..da21f37 100644 --- a/lustre/mgs/mgs_handler.c +++ b/lustre/mgs/mgs_handler.c @@ -59,7 +59,7 @@ #include #include #include "mgs_internal.h" - +#include /* Establish a connection to the MGS.*/ static int mgs_connect(struct lustre_handle *conn, struct obd_device *obd, @@ -376,6 +376,9 @@ static int mgs_handle_target_reg(struct ptlrpc_request *req) struct mgs_target_info *mti, *rep_mti; int rep_size[] = { sizeof(struct ptlrpc_body), sizeof(*mti) }; int rc = 0, lockrc; + char *ptr; + lnet_nid_t nid; + int i; ENTRY; mgs_counter_incr(req->rq_export, LPROC_MGS_TARGET_REG); @@ -412,6 +415,23 @@ static int mgs_handle_target_reg(struct ptlrpc_request *req) OBD_FAIL_TIMEOUT(OBD_FAIL_MGS_PAUSE_TARGET_REG, 10); + /* Ensure this is not a failover node that is connecting first */ + ptr = mti->mti_params; + while (class_find_param(ptr, PARAM_FAILNODE, &ptr) == 0) { + while (class_parse_nid(ptr, &nid, &ptr) == 0) { + for (i = 0; i < mti->mti_nid_count; i++) { + if (nid == mti->mti_nids[i] + && mgs_check_index(obd, mti) != 1) { + LCONSOLE_WARN("Denying registration " + "attempt from failover " + "nid %s\n", + libcfs_nid2str(nid)); + GOTO(out, rc = -EADDRNOTAVAIL); + } + } + } + } + /* Log writing contention is handled by the fsdb_sem */ if (mti->mti_flags & LDD_F_WRITECONF) { -- 1.8.3.1