Whamcloud - gitweb
LU-14779 utils: no DNS lookups for NID in get_param 56/44056/4
authorAndreas Dilger <adilger@whamcloud.com>
Wed, 23 Jun 2021 08:20:24 +0000 (02:20 -0600)
committerOleg Drokin <green@whamcloud.com>
Thu, 8 Jul 2021 02:07:29 +0000 (02:07 +0000)
commitf21c507fbca2afab5a5d97d4e816696a69d1c593
tree0dac3e78ce8a399d1c8ddfc09fb588c3be61995f
parent4fc127428f00d6a3b179a143a61ddc78e5d8ca7c
LU-14779 utils: no DNS lookups for NID in get_param

Calling libcfs_str2nid() speculatively in "lctl get_param" to see
if there is a NID in the parameter name results in multiple DNS
lookups for invalid hostnames (e.g. "exports.192.168.0.10"). That
may take a very long time if there are a large number of connected
clients, and if the DNS server overloaded or is having problems.

Instead of doing these speculative NID conversions, skip the whole
NID string in the parameter name for the two known parameters that
may contain a NID ("*.exports.<NID>.*" and "*.MGC<NID>.*").  This
is considerably faster since it is only working on a local string.

If new parameters are added that contain a NID (unlikely, but
possible), then "clean_path()" would need to be updated as part
of that change.

Fixes: 85cbe1a3ee69 ("LU-5030 util: migrate lctl params functions to use cfs_get_paths()")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I51f865e4ce3a7bc4879f9d688c4b3a68d731810f
Reviewed-on: https://review.whamcloud.com/44056
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Emoly Liu <emoly@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity.sh
lustre/utils/lustre_cfg.c