Skip to content

Commit 2dace18

Browse files
mustafakismailjgunthorpe
authored andcommitted
RDMA/irdma: Do not hold qos mutex twice on QP resume
When irdma_ws_add fails, irdma_ws_remove is used to cleanup the leaf node. This lead to holding the qos mutex twice in the QP resume path. Fix this by avoiding the call to irdma_ws_remove and unwinding the error in irdma_ws_add. This skips the call to irdma_tc_in_use function which is not needed in the error unwind cases. Fixes: 3ae331c ("RDMA/irdma: Add QoS definitions") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mustafa Ismail <[email protected]> Signed-off-by: Shiraz Saleem <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent cc07b73 commit 2dace18

File tree

1 file changed

+7
-6
lines changed
  • drivers/infiniband/hw/irdma

1 file changed

+7
-6
lines changed

drivers/infiniband/hw/irdma/ws.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,10 @@ enum irdma_status_code irdma_ws_add(struct irdma_sc_vsi *vsi, u8 user_pri)
330330

331331
tc_node->enable = true;
332332
ret = irdma_ws_cqp_cmd(vsi, tc_node, IRDMA_OP_WS_MODIFY_NODE);
333-
if (ret)
333+
if (ret) {
334+
vsi->unregister_qset(vsi, tc_node);
334335
goto reg_err;
336+
}
335337
}
336338
ibdev_dbg(to_ibdev(vsi->dev),
337339
"WS: Using node %d which represents VSI %d TC %d\n",
@@ -350,6 +352,10 @@ enum irdma_status_code irdma_ws_add(struct irdma_sc_vsi *vsi, u8 user_pri)
350352
}
351353
goto exit;
352354

355+
reg_err:
356+
irdma_ws_cqp_cmd(vsi, tc_node, IRDMA_OP_WS_DELETE_NODE);
357+
list_del(&tc_node->siblings);
358+
irdma_free_node(vsi, tc_node);
353359
leaf_add_err:
354360
if (list_empty(&vsi_node->child_list_head)) {
355361
if (irdma_ws_cqp_cmd(vsi, vsi_node, IRDMA_OP_WS_DELETE_NODE))
@@ -369,11 +375,6 @@ enum irdma_status_code irdma_ws_add(struct irdma_sc_vsi *vsi, u8 user_pri)
369375
exit:
370376
mutex_unlock(&vsi->dev->ws_mutex);
371377
return ret;
372-
373-
reg_err:
374-
mutex_unlock(&vsi->dev->ws_mutex);
375-
irdma_ws_remove(vsi, user_pri);
376-
return ret;
377378
}
378379

379380
/**

0 commit comments

Comments
 (0)