Whamcloud - gitweb
LU-17700 lnet: properly calculate ping buffer size 73/54673/5
authorJames Simmons <jsimmons@infradead.org>
Fri, 5 Apr 2024 00:01:32 +0000 (20:01 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 15 Apr 2024 16:51:37 +0000 (16:51 +0000)
commitc987469d510a8edf2bad5c28239337b47015c82e
treecdc4dbe1dffce1548b2f2d35d4cc94e5f26fdac9
parent0176629ab3f71e88850ab95796b0e519c4d0f740
LU-17700 lnet: properly calculate ping buffer size

Originally for lnet_ping() we allocated the ping buffer size by
using lnet_ping_sts_size(). The limitation to that approach is
that if the nid passed into lnet_ping_sts_size() is a smaller
NID like IPv4 the buffer could be too small. Say n_ids is 4
and 3 returned NIDs are IPv4 but one is IPv6 then it can overflow.
The solution is allocate maximum possible NID size. That can be
done with LNET_ANY_NID which fills in all the fields. For
lnet_ping_sts_size() we have to properly handle the size when
using LNET_ANY_NID. If struct lnet_nid ever increasing in the
future this code should still work.

Also cap the maximum size of the ping buffer to avoid o2iblnd
failures from using RDMA which sends data that doesn't support
large NIDs.

Fixes: d137e9823ca ("LU-10003 lnet: use Netlink to support LNet ping commands")
Test-Parameters: trivial testlist=sanity-lnet
Change-Id: I5b61add2b3701cad12074515f45773bbc9fbc583
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54673
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Cyril Bordage <cbordage@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Stephane Thiell <sthiell@stanford.edu>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/include/lnet/lib-types.h
lnet/lnet/api-ni.c