From 8276ade19d573c6eb3b561dbcbc30de607a703fd Mon Sep 17 00:00:00 2001 From: James Simmons Date: Tue, 21 Nov 2023 20:51:18 -0500 Subject: [PATCH] LU-10391 mgs: copy full nid string For IPv6 testing in mgs_steal_client_llog_handler() the full NID string was not being copied. Instead we copied the size of pointer not the NID string. Copy the full NID string. Fixes: c0cb747e ("LU-13306 mgs: use large NIDS in the nid table on the MGS") Change-Id: I7e19db0b0d3806c1c6fabe2ede0d880a45fe3052 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53115 Reviewed-by: Neil Brown Reviewed-by: Etienne AUJAMES Reviewed-by: Timothy Day Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- lustre/mgs/mgs_llog.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index c95e5d4..d547b168 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -2221,10 +2221,11 @@ static int mgs_steal_client_llog_handler(const struct lu_env *env, lnet_nid_t nodenid = lcfg->lcfg_nid; char *nidstr = NULL; + BUILD_BUG_ON(sizeof(tmti->mti_nidlist[0]) != LNET_NIDSTR_SIZE); if (!nodenid) { nidstr = lustre_cfg_buf(lcfg, 2); - if (!nidstr) + if (!nidstr || !strlen(nidstr)) RETURN(-ENODEV); } @@ -2240,7 +2241,7 @@ static int mgs_steal_client_llog_handler(const struct lu_env *env, if (nidstr) { if (dst) { rc = strscpy(dst, nidstr, - sizeof(nidstr)); + LNET_NIDSTR_SIZE); if (rc < 0) RETURN(rc); } else { -- 1.8.3.1