diff options
author | Leon Romanovsky <leonro@mellanox.com> | 2020-09-07 15:09:18 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@nvidia.com> | 2020-09-09 14:14:29 -0300 |
commit | 43d781b9fa562f0c6e50f62c870fbfeb9dc85213 (patch) | |
tree | 6ee87ba81d8f7a5fde19e0f0665f905384a967c5 /drivers/infiniband/core/cq.c | |
parent | 7e3c66c9a989d5b53387ceebc88b9e4a9b1d6434 (diff) | |
download | linux-43d781b9fa562f0c6e50f62c870fbfeb9dc85213.tar.gz linux-43d781b9fa562f0c6e50f62c870fbfeb9dc85213.tar.bz2 linux-43d781b9fa562f0c6e50f62c870fbfeb9dc85213.zip |
RDMA: Allow fail of destroy CQ
Like any other verbs objects, CQ shouldn't fail during destroy, but
mlx5_ib didn't follow this contract with mixed IB verbs objects with
DEVX. Such mix causes to the situation where FW and kernel are fully
interdependent on the reference counting of each side.
Kernel verbs and drivers that don't have DEVX flows shouldn't fail.
Fixes: e39afe3d6dbd ("RDMA: Convert CQ allocations to be under core responsibility")
Link: https://lore.kernel.org/r/20200907120921.476363-7-leon@kernel.org
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/infiniband/core/cq.c')
-rw-r--r-- | drivers/infiniband/core/cq.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/infiniband/core/cq.c b/drivers/infiniband/core/cq.c index ab556407803c..11edf7308eac 100644 --- a/drivers/infiniband/core/cq.c +++ b/drivers/infiniband/core/cq.c @@ -319,6 +319,8 @@ EXPORT_SYMBOL(__ib_alloc_cq_any); */ void ib_free_cq(struct ib_cq *cq) { + int ret; + if (WARN_ON_ONCE(atomic_read(&cq->usecnt))) return; if (WARN_ON_ONCE(cq->cqe_used)) @@ -340,8 +342,9 @@ void ib_free_cq(struct ib_cq *cq) rdma_dim_destroy(cq); trace_cq_free(cq); + ret = cq->device->ops.destroy_cq(cq, NULL); + WARN_ONCE(ret, "Destroy of kernel CQ shouldn't fail"); rdma_restrack_del(&cq->res); - cq->device->ops.destroy_cq(cq, NULL); kfree(cq->wc); kfree(cq); } |