Commit 68237a0f authored by Faisal Latif's avatar Faisal Latif Committed by Roland Dreier

RDMA/nes: Fix FIN state handling under error conditions

During cluster testing, one QP was not closed, as FIN is not handled
properly when its rexmit count expires or in some cases when RST is is
received after sending FIN.  The reason is that the cm_id does not get
decremented under these conditions.
Signed-off-by: default avatarFaisal Latif <faisal.latif@intel.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 66388d67
...@@ -472,6 +472,7 @@ int schedule_nes_timer(struct nes_cm_node *cm_node, struct sk_buff *skb, ...@@ -472,6 +472,7 @@ int schedule_nes_timer(struct nes_cm_node *cm_node, struct sk_buff *skb,
static void nes_retrans_expired(struct nes_cm_node *cm_node) static void nes_retrans_expired(struct nes_cm_node *cm_node)
{ {
struct iw_cm_id *cm_id = cm_node->cm_id;
switch (cm_node->state) { switch (cm_node->state) {
case NES_CM_STATE_SYN_RCVD: case NES_CM_STATE_SYN_RCVD:
case NES_CM_STATE_CLOSING: case NES_CM_STATE_CLOSING:
...@@ -479,7 +480,9 @@ static void nes_retrans_expired(struct nes_cm_node *cm_node) ...@@ -479,7 +480,9 @@ static void nes_retrans_expired(struct nes_cm_node *cm_node)
break; break;
case NES_CM_STATE_LAST_ACK: case NES_CM_STATE_LAST_ACK:
case NES_CM_STATE_FIN_WAIT1: case NES_CM_STATE_FIN_WAIT1:
case NES_CM_STATE_MPAREJ_RCVD: if (cm_node->cm_id)
cm_id->rem_ref(cm_id);
cm_node->state = NES_CM_STATE_CLOSED;
send_reset(cm_node, NULL); send_reset(cm_node, NULL);
break; break;
default: default:
...@@ -1406,6 +1409,7 @@ static void handle_rst_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, ...@@ -1406,6 +1409,7 @@ static void handle_rst_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb,
case NES_CM_STATE_CLOSED: case NES_CM_STATE_CLOSED:
drop_packet(skb); drop_packet(skb);
break; break;
case NES_CM_STATE_FIN_WAIT1:
case NES_CM_STATE_LAST_ACK: case NES_CM_STATE_LAST_ACK:
cm_node->cm_id->rem_ref(cm_node->cm_id); cm_node->cm_id->rem_ref(cm_node->cm_id);
case NES_CM_STATE_TIME_WAIT: case NES_CM_STATE_TIME_WAIT:
...@@ -1413,8 +1417,6 @@ static void handle_rst_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, ...@@ -1413,8 +1417,6 @@ static void handle_rst_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb,
rem_ref_cm_node(cm_node->cm_core, cm_node); rem_ref_cm_node(cm_node->cm_core, cm_node);
drop_packet(skb); drop_packet(skb);
break; break;
case NES_CM_STATE_FIN_WAIT1:
nes_debug(NES_DBG_CM, "Bad state %s[%u]\n", __func__, __LINE__);
default: default:
drop_packet(skb); drop_packet(skb);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment