Whamcloud - gitweb
LU-17793 libcfs: fix objtool warning in lbug_with_loc() 05/55505/4
authorJian Yu <yujian@whamcloud.com>
Tue, 25 Jun 2024 03:00:20 +0000 (20:00 -0700)
committerOleg Drokin <green@whamcloud.com>
Mon, 8 Jul 2024 20:12:09 +0000 (20:12 +0000)
commit9f44a48b365924ee6f576c95bf0649160b6be58a
treebe4856afce0fa100daeb91f01ead91fa41ff7942
parent8ad0c0dd34255c5f4f52e2c13623a74eaf9303da
LU-17793 libcfs: fix objtool warning in lbug_with_loc()

After lbug_with_loc() was removed from the objtool
global_noreturns array in Linux commit v6.4-rc2-10-g34245659debd,
building Lustre hit the following warning:

  libcfs/libcfs/fail.o: warning: objtool: __cfs_fail_check_set()
  falls through to next function __cfs_fail_timeout_set()

This patch fixes the above warning by adding an unreachable
panic() at the end of lbug_with_loc() to terminate all of
the call paths in that function.

As a consequence of this change, we need to make the patch
fix more errors, such as:

  lnet/lnet/api-ni.c: In function 'lnet_res_type2str':
  libcfs/include/libcfs/libcfs_private.h:119:9:
  error: this statement may fall through [-Werror=implicit-fallthrough=]
    119 |         lbug_with_loc(&msgdata); \
        |         ^~~~~~~~~~~~~~~~~~~~~~~
  lnet/lnet/api-ni.c:1143:17: note: in expansion of macro 'LBUG'
   1143 |                 LBUG();
        |                 ^~~~
  lnet/lnet/api-ni.c:1144:9: note: here
   1144 |         case LNET_COOKIE_TYPE_MD:
        |         ^~~~

and

  lustre/obdclass/lprocfs_status.c: In function 'lprocfs_stats_lock':
  lustre/obdclass/lprocfs_status.c:470:1:
  error: control reaches end of non-void function [-Werror=return-type]
    470 | }
        | ^

Change-Id: I5574559619b4b6746f4e7da51f3213ede246a73b
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55505
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Aurelien Degremont <adegremont@nvidia.com>
Reviewed-by: Bruno Faccini <bfaccini@nvidia.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
config/lustre-build-linux.m4
libcfs/include/libcfs/libcfs_private.h
libcfs/libcfs/debug.c
lustre/llite/pcc.c
lustre/obdclass/lprocfs_status.c
lustre/osp/osp_object.c
lustre/ptlrpc/pack_generic.c