Whamcloud - gitweb
LU-10391 mgs: copy full nid string 15/53115/5
authorJames Simmons <jsimmons@infradead.org>
Wed, 22 Nov 2023 01:51:18 +0000 (20:51 -0500)
committerOleg Drokin <green@whamcloud.com>
Wed, 29 Nov 2023 21:26:19 +0000 (21:26 +0000)
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 <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53115
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Etienne AUJAMES <eaujames@ddn.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/mgs/mgs_llog.c

index c95e5d4..d547b16 100644 (file)
@@ -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 {