RDMA/cm: Spurious WARNING triggered in cm_destroy_id()
authorKa-Cheong Poon <ka-cheong.poon@oracle.com>
Wed, 3 Jun 2020 13:33:38 +0000 (06:33 -0700)
committerJason Gunthorpe <jgg@mellanox.com>
Wed, 3 Jun 2020 18:48:18 +0000 (15:48 -0300)
If the cm_id state is IB_CM_REP_SENT when cm_destroy_id() is called, it
calls cm_send_rej_locked().

In cm_send_rej_locked(), it calls cm_enter_timewait() and the state is
changed to IB_CM_TIMEWAIT.

Now back to cm_destroy_id(), it breaks from the switch statement, and the
next call is WARN_ON(cm_id->state != IB_CM_IDLE).

This triggers a spurious warning. Instead, the code should goto retest
after returning from cm_send_rej_locked() to move the state to IDLE.

Fixes: 67b3c8dceac6 ("RDMA/cm: Make sure the cm_id is in the IB_CM_IDLE state in destroy")
Link: https://lore.kernel.org/r/1591191218-9446-1-git-send-email-ka-cheong.poon@oracle.com
Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/cm.c

index 085c146fe4008be67c75c8efeec032a5509e26d8..9ce787e37e22a652fdf2bdf7216d438ab24914cd 100644 (file)
@@ -1111,7 +1111,9 @@ retest:
        case IB_CM_REP_SENT:
        case IB_CM_MRA_REP_RCVD:
                ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg);
-               /* Fall through */
+               cm_send_rej_locked(cm_id_priv, IB_CM_REJ_CONSUMER_DEFINED, NULL,
+                                  0, NULL, 0);
+               goto retest;
        case IB_CM_MRA_REQ_SENT:
        case IB_CM_REP_RCVD:
        case IB_CM_MRA_REP_SENT: