Whamcloud - gitweb
LU-9680 utils: fix nested attribute handling in liblnetconfig 89/53889/5
authorJames Simmons <jsimmons@infradead.org>
Thu, 15 Feb 2024 18:51:30 +0000 (13:51 -0500)
committerOleg Drokin <green@whamcloud.com>
Mon, 4 Mar 2024 19:56:42 +0000 (19:56 +0000)
commit8f64231185a974c561c0603003d1e3f1749a390b
tree05c0538dc82df9838ac185830b486aa59b1b5487
parentbc256c25631960e1386f3359bb6c85cfe6481fb7
LU-9680 utils: fix nested attribute handling in liblnetconfig

Testing with several different YAML layouts revealed several
limitations. The first breakage discovered while porting LNet
export to Netlink was that for a nested list if the first
attribute processed was another nested list the YAML generated
was missing the needed '-'. Now we instert it manually.

The second problem was the idea of updating an individual key
didn't work which was discovered while testing lustre stats.
We moved the printing of the new key to under NLA_NESTED case
directly. This required created yaml_nested_header() which
handles both empty nested list and ones containing data.
The comments added to the library should make this clear.

Sending Netlink packets also had some bugs that have been
resolved. The function yaml_fill_scalar_data() is used to
parse out simple scalar values and key value pairs. The
original codes parsing of the input string altered the
string. This broke the do while loop over entry since
entry dropped the rest of the configuration data. Instead
of altering the string we carefully parse the string
without altering it.

Handle the case when nla_nest_start() fails to create
a nlattr in lnet_genl_parse_list() which prevents a
node crash when we run out of space in the skbuff.

Make sure the skbuff is large enough for LNet NI
Netlink data collection by setting cb->min_dump_alloc
to U16_MAX.

Test-Parameters: trivial testlist=sanity-lnet
Fixes: d137e9823ca ("LU-10003 lnet: use Netlink to support LNet ping commands")
Change-Id: I2d702c9211abffc051db3203ec3811ceaedb2376
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53889
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/lnet/api-ni.c
lnet/utils/lnetconfig/liblnetconfig_netlink.c