It was wrong to remove lnet_selftest_structure_assertion()
since it contained BUILD_BUGs used to ensure different LNet
Selftest versions can interoperate.
Restore the BUILD_BUGs and add a dummy user in LNet Selftest
init. This should prevent analyzers from picking this up as
an unused function.
Fixes: 43cbc93 ("LU-8191 lnet: remove unused, fix non-static functions")
Test-Parameters: trivial
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: I5e498dc411048f0ae3ca69cc5d24a728a711d6f7
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54635
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
}
}
+void
+lnet_selftest_structure_assertion(void)
+{
+ BUILD_BUG_ON(sizeof(struct srpc_msg) != 160);
+ BUILD_BUG_ON(sizeof(struct srpc_test_reqst) != 70);
+ BUILD_BUG_ON(offsetof(struct srpc_msg, msg_body.tes_reqst.tsr_concur) !=
+ 72);
+ BUILD_BUG_ON(offsetof(struct srpc_msg, msg_body.tes_reqst.tsr_ndest) !=
+ 78);
+ BUILD_BUG_ON(sizeof(struct srpc_stat_reply) != 136);
+ BUILD_BUG_ON(sizeof(struct srpc_stat_reqst) != 28);
+}
+
static int __init
lnet_selftest_init(void)
{
int rc = -ENOMEM;
int i;
+ /* This assertion checks that struct sizes do not drift
+ * inadvertently and induce crashes when different nodes
+ * running LNet Selftest have mismatched structures.
+ */
+ lnet_selftest_structure_assertion();
+
rc = libcfs_setup();
if (rc)
return rc;