Whamcloud - gitweb
LU-17174 misc: fix hash functions 11/52611/4
authorAlexey Lyashkov <alexey.lyashkov@hpe.com>
Tue, 10 Oct 2023 08:38:21 +0000 (11:38 +0300)
committerOleg Drokin <green@whamcloud.com>
Wed, 29 Nov 2023 21:24:24 +0000 (21:24 +0000)
commitce404bd07c37f45d8c8fe0cf3e3ecf6e18740f43
treed736bc464cfbad81af8a41151cba0e40d156f4c6
parent1bb972b8bf86accb5e53f0a35e64c89e5908a889
LU-17174 misc: fix hash functions

1) LU-16518 landing caused a bug which visible with debug kernel

UBSAN: Undefined behaviour in include/linux/hash.h:81:31
shift exponent 64 is too large for 64-bit type
'long long unsigned int'
Call Trace:
dump_stack+0x8e/0xd0
ubsan_epilogue+0x5/0x21
ldlm_export_lock_hash+0x49/0x4d [ptlrpc]
cfs_hash_bd_from_key+0x88/0x2e0 [libcfs]

2) use a high bits unstead of low as it more accurate.

HPe-bug-id: LUS-11925
Fixes: 239e8268 (LU-16518 misc: use fixed hash code)
Signed-off-by: Alexey Lyashkov <alexey.lyashkov@hpe.com>
Change-Id: Ie1c531ad220f44e55fbf80674a49472fb6024252
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52611
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
12 files changed:
libcfs/include/libcfs/libcfs_hash.h
libcfs/libcfs/hash.c
lustre/ldlm/ldlm_flock.c
lustre/ldlm/ldlm_lockd.c
lustre/mdt/mdt_hsm_cdt_actions.c
lustre/mdt/mdt_hsm_cdt_requests.c
lustre/obdclass/jobid.c
lustre/obdclass/lprocfs_jobstats.c
lustre/obdclass/obd_config.c
lustre/ptlrpc/nodemap_handler.c
lustre/ptlrpc/nrs_tbf.c
lustre/quota/lquota_entry.c