Whamcloud - gitweb
LU-7734 lnet: fix lnet shutdown race 32/21532/9
authorOlaf Weber <olaf@sgi.com>
Fri, 27 Jan 2017 15:13:29 +0000 (16:13 +0100)
committerOlaf Weber <olaf@sgi.com>
Fri, 27 Jan 2017 15:40:46 +0000 (16:40 +0100)
commit745b5a05a8c028e45fe0a9b1c5dc1a4c7ef84b63
tree64653c4f372eb52938d5b7366b00c27cd72023c7
parent2c789d9c3818bc253d73d28b7ef9292ef5c39de8
LU-7734 lnet: fix lnet shutdown race

The locking changes for the lnet_net_lock made for Multi-Rail
introduce a race in the LNet shutdown path. The code keeps two
states in the_lnet.ln_shutdown: 0 means LNet is either up and
running or shut down, while 1 means lnet is shutting down. In
lnet_select_pathway() if we need to restart and drop and relock
the lnet_net_lock we can find that LNet went from running to
stopped, and not be able to tell the difference.

Replace ln_shutdown with a three-state ln_state patterned on
ln_rc_state: states are LNET_STATE_SHUTDOWN, LNET_STATE_RUNNING,
and LNET_STATE_STOPPING. Most checks against ln_shutdown now test
ln_state against LNET_STATE_RUNNING. LNet moves to RUNNING state
in lnet_startup_lndnets().

Test-Parameters: trivial
Signed-off-by: Olaf Weber <olaf@sgi.com>
Change-Id: I241fe329171c88cd8ca62d3eaa83aec4d66dad54
lnet/include/lnet/lib-types.h
lnet/lnet/api-ni.c
lnet/lnet/lib-move.c
lnet/lnet/lib-ptl.c
lnet/lnet/peer.c
lnet/lnet/router.c