Whamcloud - gitweb
LU-10391 mgs: handle strscpy return value properly 71/53571/3
authorJames Simmons <jsimmons@infradead.org>
Tue, 2 Jan 2024 00:11:35 +0000 (19:11 -0500)
committerOleg Drokin <green@whamcloud.com>
Wed, 10 Jan 2024 07:28:48 +0000 (07:28 +0000)
The function strscpy() returns either an error code or the length
of the string copied. We need on success of strscpy in the
function mgs_steal_client_llog_handler() reset rc to zero to avoid
the return value been seen as an error. While we could use large
NIDs some functionality like nodemap was failing due to this
mishandling of the return code.

Fixes: c0cb747ebe9 ("LU-13306 mgs: use large NIDS in the nid table on the MGS")
Test-Parameters: trivial
Change-Id: I013d34e0d0223367efea97f71dd4baa1052e2e1b
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53571
Reviewed-by: Andreas Dilger <adilger@whamcloud.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 d547b16..41f08c6 100644 (file)
@@ -2244,6 +2244,7 @@ static int mgs_steal_client_llog_handler(const struct lu_env *env,
                                                     LNET_NIDSTR_SIZE);
                                        if (rc < 0)
                                                RETURN(rc);
+                                       rc = 0;
                                } else {
                                        tmti->mti_nids[tmti->mti_nid_count] =
                                                libcfs_str2nid(nidstr);