From: Amir Shehata Date: Mon, 8 Jul 2019 19:33:31 +0000 (-0700) Subject: LU-10931 lnet: handle unlink before send completes X-Git-Tag: 2.12.58~70 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=d8fc5c23fe541e0ff6ce5bec6302957714c3f69f LU-10931 lnet: handle unlink before send completes If LNetMDUnlink() is called on an md with md->md_refcount > 0 then the eq callback isn't called. There is a scenario where the response times out before the send completes. So we have a refcount on the MD. The Unlink callback gets dropped on the floor. Send completes, but because we've already timed out, the REPLY for the GET is dropped. Now we're left with a peer that is in the following state: LNET_PEER_MULTI_RAIL LNET_PEER_DISCOVERING LNET_PEER_PING_SENT But no more events are coming to it, and the discovery never completes. This scenario can get RPCs stuck as well if the response times out before the send completes. The solution is to set the event status to -ETIMEDOUT to inform the send event handler that it should not expect a reply Signed-off-by: Amir Shehata Change-Id: Ica0e1a823d0d1200bb8cc42a6e058785da1d4fa4 Reviewed-on: https://review.whamcloud.com/35444 Tested-by: jenkins Reviewed-by: Chris Horn Tested-by: Maloo Reviewed-by: Alexandr Boyko Reviewed-by: Olaf Weber Reviewed-by: Oleg Drokin --- diff --git a/lnet/lnet/lib-msg.c b/lnet/lnet/lib-msg.c index 3fdc189..19c9e77 100644 --- a/lnet/lnet/lib-msg.c +++ b/lnet/lnet/lib-msg.c @@ -827,7 +827,12 @@ lnet_msg_detach_md(struct lnet_msg *msg, int cpt, int status) unlink = lnet_md_unlinkable(md); if (md->md_eq != NULL) { - msg->msg_ev.status = status; + if ((md->md_flags & LNET_MD_FLAG_ABORTED) && !status) { + msg->msg_ev.status = -ETIMEDOUT; + CDEBUG(D_NET, "md 0x%p already unlinked\n", md); + } else { + msg->msg_ev.status = status; + } msg->msg_ev.unlinked = unlink; lnet_eq_enqueue_event(md->md_eq, &msg->msg_ev); }