From bbe5f8ec92c63cc4fcb9ab0b316e92fb2a3d9683 Mon Sep 17 00:00:00 2001 From: Li Wei Date: Wed, 17 Sep 2014 13:55:33 +0800 Subject: [PATCH] LU-4749 mgs: Recognize colons in failover.node values Current mgs assumes that all the NIDs in a single failover.node parameter belong to one node. This is not the case, even prior to http://review.whamcloud.com/11161, because mkfs.lustre options like --servicenode=,:, are allowed. Change-Id: If3e2ebc0e81093e9c8304e496afdca24edf456ef Signed-off-by: Li Wei Reviewed-on: http://review.whamcloud.com/11956 Tested-by: Jenkins Reviewed-by: Johann Lombardi Tested-by: Maloo Reviewed-by: Liang Zhen --- lustre/mgs/mgs_llog.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index 161d386..1fbc87d 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -1883,7 +1883,12 @@ static int mgs_write_log_failnids(const struct lu_env *env, #07 L add_conn 0:OSC_uml1_ost1_mdsA 1:uml2_UUID */ - /* Pull failnid info out of params string */ + /* + * Pull failnid info out of params string, which may contain something + * like ",:,". class_parse_nid() does not + * complain about abnormal inputs like ",:", ":,", + * etc. However, convert_hostnames() should have caught those. + */ while (class_find_param(ptr, PARAM_FAILNODE, &ptr) == 0) { while (class_parse_nid(ptr, &nid, &ptr) == 0) { if (failnodeuuid == NULL) { @@ -1898,15 +1903,25 @@ static int mgs_write_log_failnids(const struct lu_env *env, "client %s\n", libcfs_nid2str(nid), failnodeuuid, cliname); rc = record_add_uuid(env, llh, nid, failnodeuuid); - } + /* + * If *ptr is ':', we have added all NIDs for + * failnodeuuid. + */ + if (*ptr == ':') { + rc = record_add_conn(env, llh, cliname, + failnodeuuid); + name_destroy(&failnodeuuid); + failnodeuuid = NULL; + } + } if (failnodeuuid) { rc = record_add_conn(env, llh, cliname, failnodeuuid); name_destroy(&failnodeuuid); failnodeuuid = NULL; } - } + } - return rc; + return rc; } static int mgs_write_log_mdc_to_lmv(const struct lu_env *env, -- 1.8.3.1