Whamcloud - gitweb
LU-13005 lnet: eq: discard struct lnet_handle_eq 41/36841/5
authorMr NeilBrown <neilb@suse.de>
Wed, 20 Nov 2019 00:16:34 +0000 (11:16 +1100)
committerOleg Drokin <green@whamcloud.com>
Tue, 25 Feb 2020 05:51:08 +0000 (05:51 +0000)
commit8fe28cfe925cc0266ba44c502a33d8ac6e5f4489
tree718e991639fe649aff027709b7d49c7a201478dc
parent6bf49037b3a1345877692a6ba6d92f579a8e2442
LU-13005 lnet: eq: discard struct lnet_handle_eq

The Portals API uses a cookie 'handle' to identify an EQ.  This is
appropriate for a user-space API for objects maintained by the kernel,
but it brings no value when the API client and implementation are both
in the kernel, as is the case with Lustre and LNet.

Instead of using a 'handle', a pointer to the 'struct lnet_eq` can be
used.  This object is not reference counted and is always freed
correctly, so there can be no case where the cookie becomes invalid
while it is still held.

So use 'struct lnet_eq *' directly instead of having indirection
through a 'struct lnet_handle_eq'.
Also:
 - have LNetEQAttach() return the pointer, using ERR_PTR() to return
   errors.
 - discard ln_eq_containers and don't store the me there-in.
   This means we don't free any eq that have not already been freed,
   but all eq that are allocated are properly freed, so that is not
   a problem.

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I0d6e5b654e39e749b39d46f68d0fb3e47a3256e9
Reviewed-on: https://review.whamcloud.com/36841
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Amir Shehata <ashehata@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
13 files changed:
lnet/include/lnet/api.h
lnet/include/lnet/lib-lnet.h
lnet/include/lnet/lib-types.h
lnet/include/uapi/linux/lnet/lnet-types.h
lnet/lnet/api-ni.c
lnet/lnet/lib-eq.c
lnet/lnet/lib-md.c
lnet/lnet/lib-move.c
lnet/lnet/peer.c
lnet/selftest/rpc.c
lustre/include/lustre_net.h
lustre/ptlrpc/events.c
lustre/ptlrpc/niobuf.c