Whamcloud - gitweb
LU-9680 net: Netlink improvements
With the expansion of the use of Netlink several issues have been
encountered. This patch fixes many of the issues. The issues are:
1) Fix idx handling in lnet_genl_parse_list() function. It needs
to always been incremented. Some renaming suggestion for
enum lnet_nl_scalar_attrs from Neil. New LN_SCALAR_ATTR_INT_VALUE
to allow pushing integers as well as strings from userspace.
2) Create struct genl_filter_list which will be used to create
a list of items to pass back to userland. This will be a common
setup.
3) A normal user can't read /sys/debug/kernel/lustre which breaks
lctl ***_params XXX since the first function called is
llapi_param_get_paths(). Without the ability to read the
debugfs tree glob() will fail. The solution is to use the
kernel's glob function and just pass the requested string to
the kernel.
4) For the external coordinator work you create a YAML parser
that listens for kernel generated Netlink packets. This is
a continuous stream vs an one time reply which we don't
handle correctly. We move the handling of the completion
of a Netlink packet series icompletely into the function
yaml_netlink_msg_complete. In yaml_netlink_msg_parse() for
the async case add "---" and in yaml_netlink_msg_complete()
add "..." to define the beginning and end of a YAML document.
5) We have 3 types of setups. For kernel generated events it is
possible to use just a YAML parser to listen for events. For
the normal request -> reply setup we need both a YAML emitter
and YAML parser. The last case is just sending commands to
the kernel which only needs a YAML emitter. It is possible for
that action to fail so we need to add handling for errors to
the YAML emitter. We keep error handling for the YAML parser
as well to handle the case of a stand along YAML parser listener.
6) Reworked the code that translates YAML to Netlink packets to
send to the kernel so the both key and value pairs are sent
seperately for the mapping case. This avoids dealing with
complex string parsing in the kernel.
7) Error message handling was incorrect. struct nlmsgerr msg field
is also the start of the nlattrs for the ext ack handling.
Test-Parameters: trivial
Change-Id: Ic8eee8fd0020b7a63565de6ef69f2c74bf4bdcd8
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/44358
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Ben Evans <beevans@whamcloud.com>
Reviewed-by: Petros Koutoupis <petros.koutoupis@hpe.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>