Whamcloud - gitweb
LU-12678 lnet: discard ksnn_lock 34/36834/3
authorMr NeilBrown <neilb@suse.de>
Mon, 18 Nov 2019 00:29:08 +0000 (11:29 +1100)
committerOleg Drokin <green@whamcloud.com>
Mon, 16 Dec 2019 06:00:17 +0000 (06:00 +0000)
commitfb983bbebf8127828dba545e7b778c12e5411f64
tree634bf8053370cf42f9aae61e94b63945977929e1
parent049683bc0fc069eef447cd11851f8e052de90574
LU-12678 lnet: discard ksnn_lock

This lock in 'struct ksock_net' is being taken in places where it
isn't needed, so it is worth cleaning up.

It isn't needed when checking if ksnn_npeers has reached
0 yet, as at that point in the code, the value can only
decrement to zero and then stay there.

It is only needed:
 - to ensure concurrent updates to ksnn_npeers don't race, and
 - to ensure that no more peers are added after the net is shutdown.

The first is best achieved using atomic_t.
The second is more easily achieved by replacing the ksnn_shutdown
flag with a large negative bias on ksnn_npeers, and using
atomic_inc_unless_negative().

So change ksnn_npeers to atomic_t and discard ksnn_lock
and ksnn_shutdown.

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I23dd07ef89c7abc14f5a5fef28468a62f7b2a35c
Reviewed-on: https://review.whamcloud.com/36834
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Amir Shehata <ashehata@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/klnds/socklnd/socklnd.c
lnet/klnds/socklnd/socklnd.h