Skip to content

Commit b68e1ac

Browse files
MarkZhang81rleon
authored andcommitted
RDMA/cm: Print the old state when cm_destroy_id gets timeout
The old state is helpful for debugging, as the current state is always IB_CM_IDLE when timeout happens. Fixes: 96d9cbe ("RDMA/cm: add timeout to cm_destroy_id wait") Signed-off-by: Mark Zhang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 481047d commit b68e1ac

File tree

1 file changed

+7
-4
lines changed
  • drivers/infiniband/core

1 file changed

+7
-4
lines changed

drivers/infiniband/core/cm.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,23 +1026,26 @@ static void cm_reset_to_idle(struct cm_id_private *cm_id_priv)
10261026
}
10271027
}
10281028

1029-
static noinline void cm_destroy_id_wait_timeout(struct ib_cm_id *cm_id)
1029+
static noinline void cm_destroy_id_wait_timeout(struct ib_cm_id *cm_id,
1030+
enum ib_cm_state old_state)
10301031
{
10311032
struct cm_id_private *cm_id_priv;
10321033

10331034
cm_id_priv = container_of(cm_id, struct cm_id_private, id);
1034-
pr_err("%s: cm_id=%p timed out. state=%d refcnt=%d\n", __func__,
1035-
cm_id, cm_id->state, refcount_read(&cm_id_priv->refcount));
1035+
pr_err("%s: cm_id=%p timed out. state %d -> %d, refcnt=%d\n", __func__,
1036+
cm_id, old_state, cm_id->state, refcount_read(&cm_id_priv->refcount));
10361037
}
10371038

10381039
static void cm_destroy_id(struct ib_cm_id *cm_id, int err)
10391040
{
10401041
struct cm_id_private *cm_id_priv;
1042+
enum ib_cm_state old_state;
10411043
struct cm_work *work;
10421044
int ret;
10431045

10441046
cm_id_priv = container_of(cm_id, struct cm_id_private, id);
10451047
spin_lock_irq(&cm_id_priv->lock);
1048+
old_state = cm_id->state;
10461049
retest:
10471050
switch (cm_id->state) {
10481051
case IB_CM_LISTEN:
@@ -1151,7 +1154,7 @@ static void cm_destroy_id(struct ib_cm_id *cm_id, int err)
11511154
msecs_to_jiffies(
11521155
CM_DESTROY_ID_WAIT_TIMEOUT));
11531156
if (!ret) /* timeout happened */
1154-
cm_destroy_id_wait_timeout(cm_id);
1157+
cm_destroy_id_wait_timeout(cm_id, old_state);
11551158
} while (!ret);
11561159

11571160
while ((work = cm_dequeue_work(cm_id_priv)) != NULL)

0 commit comments

Comments
 (0)