Whamcloud - gitweb
LU-17054 lnet: Change cpt-of-nid to get result from kernel 02/52502/5
authorChris Horn <chris.horn@hpe.com>
Tue, 29 Aug 2023 16:46:13 +0000 (10:46 -0600)
committerOleg Drokin <green@whamcloud.com>
Sat, 18 Nov 2023 21:44:34 +0000 (21:44 +0000)
commit466e25a6a35f140a34d14ddc75076872e2b35a0c
treeea6a086ee4d8b68361e0dcc3a685da5b6e1446c4
parentfa370c0d724b5a90e2d739e5d3c67066facf550b
LU-17054 lnet: Change cpt-of-nid to get result from kernel

The lnetctl cpt-of-nid command leverages a userspace implementation
of the kernel hash_long() function to compute the CPT for a given
NID. However, the kernel hash_long() function has changed over time
such that the userspace version may give a different result than the
kernel version. Since Lustre supports such a wide range of kernels
we cannot simply update the userspace implementation of hash_long() to
match newer kernel.

Address this by re-implementing lnetctl cpt-of-nid to call into kernel
space to compute the CPT and return the result to userspace.

lnetctl cpt-of-nid now works with extended NIDs (e.g., IPv6).

lnetctl cpt-of-nid no longer accepts the --ncpt argument because the
kernel functions for computing the cpt do not support this.

lnetctl cpt-of-nid no longer accepts the --nid argument. Instead, the
command now takes a space separated list of nids.

Example:
$ lnetctl cpt-of-nid 867@kfi 5.3.0.9@tcp
cpt-of-nid:
- nid: 867@kfi
  cpt: 0
- nid: 5.3.0.9@tcp
  cpt: 1
$

Because the old implementation could return a wrong result it is
completely removed.

HPE-bug-id: LUS-11785
Test-Parameters: trivial
Signed-off-by: Chris Horn <chris.horn@hpe.com>
Change-Id: I7c2bc48c5c0da7da8a4425d319c0b99207814ae1
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52502
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/include/lnet/lib-types.h
lnet/include/uapi/linux/lnet/lnet-dlc.h
lnet/lnet/api-ni.c
lnet/utils/lnetconfig/liblnetconfig.c
lnet/utils/lnetconfig/liblnetconfig.h
lnet/utils/lnetctl.c