The rdma layer ibmr is always added to busy list of the pool after
memory is allocated. In case the lower layer fmr allocation fails,
it should be removed from the busy list before memoryis freed but
it wasn't. Thus the freed ibmr is left in busy list, and the busy list
gets into unstable state.
Fix is to add busy_list only when fmr is allocated successfully
Orabug:
21795840
Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Reviewed-by: Chien Yen <chien.yen@oracle.com>
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
goto out_no_cigar;
}
- memset(ibmr, 0, sizeof(*ibmr));
-
- INIT_LIST_HEAD(&ibmr->pool_list);
- spin_lock(&pool->busy_lock);
- list_add(&ibmr->pool_list, &pool->busy_list);
- spin_unlock(&pool->busy_lock);
-
ibmr->fmr = ib_alloc_fmr(rds_ibdev->pd,
(IB_ACCESS_LOCAL_WRITE |
IB_ACCESS_REMOTE_READ |
goto out_no_cigar;
}
+ INIT_LIST_HEAD(&ibmr->pool_list);
+ spin_lock(&pool->busy_lock);
+ list_add(&ibmr->pool_list, &pool->busy_list);
+ spin_unlock(&pool->busy_lock);
+
ibmr->pool = pool;
if (pool->pool_type == RDS_IB_MR_8K_POOL)
rds_ib_stats_inc(s_ib_rdma_mr_8k_alloc);