LU-18383 ksocklnd: Avoid TCP socket orphans in racy LNet
LU-18137
3367ef3eb2 introduced code to handle upstream kernel changes
with regards to releasing kernel sockets. Under heavy/racy LNet
hello transactions between servers and clients, client TCP sockets
can transition to a orphan state that is never reaped. This commit
moves LU-18137's fix closer to the kernel socket allocation to
avoid this racy connection setup condition.
This commit also provides a backport of the kernel's socket
accounting function sock_inuse_add() for compatibility when vendor
kernels lack the static function definition in their kernel headers.
The lnet_compat.h file has been introduced for a place to put such
compatibility code.
Fixes:
3367ef3eb2 ("LU-18137 ksocklnd: Fix TCP socket cleanup")
Signed-off-by: Josh Samuelson <josh@1up.unl.edu>
Change-Id: I11fc0b53e051871da26c079e9aeb50976b20bbd3
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56737
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Mark Roper <ropermar@amazon.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>