From: Timothy Day Date: Fri, 29 Mar 2024 20:03:30 +0000 (+0000) Subject: LU-8191 selftest: restore BUILD_BUGs X-Git-Tag: 2.15.62~6 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F35%2F54635%2F4;p=fs%2Flustre-release.git LU-8191 selftest: restore BUILD_BUGs 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 Change-Id: I5e498dc411048f0ae3ca69cc5d24a728a711d6f7 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54635 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Arshad Hussain Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lnet/selftest/module.c b/lnet/selftest/module.c index d1ecb02..aafb427 100644 --- a/lnet/selftest/module.c +++ b/lnet/selftest/module.c @@ -67,6 +67,19 @@ lnet_selftest_exit(void) } } +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) { @@ -74,6 +87,12 @@ 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;