Whamcloud - gitweb
LU-1600 lnet: another race in lnet_nid2peer_locked
authorLiang Zhen <liang@whamcloud.com>
Tue, 10 Jul 2012 16:02:10 +0000 (00:02 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 19 Jul 2012 04:10:25 +0000 (00:10 -0400)
commit3ba222d5230cd89713aaf11cf0d8a8bc7ca62107
tree84f5f41c25247301664a9d14e3d5ff90ee2073cd
parentd42fdb3fa8965ce2c5223bec7caec9b202e5fe22
LU-1600 lnet: another race in lnet_nid2peer_locked

We fixed a race for the case that LNet is shutdown while the second
thread is in progress of creating a peer, but there is another race
if LNet is shutdown _before_ lnet_nid2peer_locked is called by the
second thread, for example: called from lnet_parse() by LND thread,
in this case, we should return error w/o trying to create peer,
otherwise the shuttingdown thread could think peer-table is empty
and move to the next step with leaving a peer on deathrow list.

This patch also passed error code into lnet_finalize() when it's
called from lnet_drop_delayed_msg_list, otherwise lnet_finalize()
will treat the message as a complete message and hit assertion
because the message is actually incomplet.

We also did some coding style cleanup in this patch.

Signed-off-by: Liang Zhen <liang@whamcloud.com>
Change-Id: I445298d639173840687412b11da41006ddc20c10
Reviewed-on: http://review.whamcloud.com/3369
Tested-by: Hudson
Reviewed-by: Bobi Jam <bobijam@whamcloud.com>
Reviewed-by: Doug Oucharek <doug@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/lnet/lib-move.c
lnet/lnet/peer.c
lnet/lnet/router.c