On 6/22/2020 3:29 PM, Jason Gunthorpe wrote:
On Sun, Jun 21, 2020 at 01:41:10PM +0300, Leon Romanovsky wrote:
@@ -2318,19 +2313,18 @@ EXPORT_SYMBOL(ib_alloc_xrcd_user);
int ib_dealloc_xrcd_user(struct ib_xrcd *xrcd, struct ib_udata *udata)
{
+ unsigned long index;
struct ib_qp *qp;
int ret;
if (atomic_read(&xrcd->usecnt))
return -EBUSY;
- while (!list_empty(&xrcd->tgt_qp_list)) {
- qp = list_entry(xrcd->tgt_qp_list.next, struct ib_qp, xrcd_list);
+ xa_for_each(&xrcd->tgt_qps, index, qp) {
ret = ib_destroy_qp(qp);
if (ret)
return ret;
}
Why doesn't this need to hold the tgt_qps_rwsem?
Jason
Actually, we don't need this part of code. if usecnt is zero so we don't
have any tgt qp in the list. I guess it is leftovers of ib_release_qp
which was already deleted.