When rdma_accept fails, rdma_reject is called in it. As such, it is
not necessary to execute rdma_reject again.
Cc: Joe Jin <redacted>
Cc: Junxiao Bi <redacted>
Signed-off-by: Zhu Yanjun <redacted>
---
net/rds/ib_cm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
@@ -677,8 +677,7 @@ int rds_ib_cm_handle_connect(struct rdma_cm_id *cm_id,event->param.conn.initiator_depth);/* rdma_accept() calls rdma_reject() internally if it fails */-err=rdma_accept(cm_id,&conn_param);-if(err)+if(rdma_accept(cm_id,&conn_param))rds_ib_conn_error(conn,"rdma_accept failed (%d)\n",err);out:
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
The function ib_dealloc_fmr will never be called. As such, it should
be removed.
Cc: Joe Jin <redacted>
Cc: Junxiao Bi <redacted>
Signed-off-by: Zhu Yanjun <redacted>
---
net/rds/ib_fmr.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
From: Johannes Thumshirn <hidden> Date: 2017-03-09 08:17:44
On 03/09/2017 08:26 AM, Zhu Yanjun wrote:
quoted hunk
The function ib_dealloc_fmr will never be called. As such, it should
be removed.
Cc: Joe Jin <redacted>
Cc: Junxiao Bi <redacted>
Signed-off-by: Zhu Yanjun <redacted>
---
net/rds/ib_fmr.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
kfree() already does a NULL check (see
http://lxr.free-electrons.com/source/mm/slab.c#L3811) so no need to do
it here.
--
Johannes Thumshirn Storage
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
When some errors occur, the scatter/gather list mapped to DMA addresses
should be handled.
Cc: Joe Jin <redacted>
Cc: Junxiao Bi <redacted>
Signed-off-by: Zhu Yanjun <redacted>
---
net/rds/ib_fmr.c | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
@@ -113,29 +113,39 @@ static int rds_ib_map_fmr(struct rds_ib_device *rds_ibdev,u64dma_addr=ib_sg_dma_address(dev,&scat[i]);if(dma_addr&~PAGE_MASK){-if(i>0)+if(i>0){+ib_dma_unmap_sg(dev,sg,nents,+DMA_BIDIRECTIONAL);return-EINVAL;-else+}else{++page_cnt;+}}if((dma_addr+dma_len)&~PAGE_MASK){-if(i<sg_dma_len-1)+if(i<sg_dma_len-1){+ib_dma_unmap_sg(dev,sg,nents,+DMA_BIDIRECTIONAL);return-EINVAL;-else+}else{++page_cnt;+}}len+=dma_len;}page_cnt+=len>>PAGE_SHIFT;-if(page_cnt>ibmr->pool->fmr_attr.max_pages)+if(page_cnt>ibmr->pool->fmr_attr.max_pages){+ib_dma_unmap_sg(dev,sg,nents,DMA_BIDIRECTIONAL);return-EINVAL;+}dma_pages=kmalloc_node(sizeof(u64)*page_cnt,GFP_ATOMIC,rdsibdev_to_node(rds_ibdev));-if(!dma_pages)+if(!dma_pages){+ib_dma_unmap_sg(dev,sg,nents,DMA_BIDIRECTIONAL);return-ENOMEM;+}page_cnt=0;for(i=0;i<sg_dma_len;++i){
@@ -148,8 +158,10 @@ static int rds_ib_map_fmr(struct rds_ib_device *rds_ibdev,}ret=ib_map_phys_fmr(fmr->fmr,dma_pages,page_cnt,io_addr);-if(ret)+if(ret){+ib_dma_unmap_sg(dev,sg,nents,DMA_BIDIRECTIONAL);gotoout;+}/* Success - we successfully remapped the MR, so we can*safelyteardowntheoldmapping.
The function rds_ib_map_fmr is used only in the ib_fmr.c
file. As such, the static type is added to limit it in this file.
Cc: Joe Jin <redacted>
Cc: Junxiao Bi <redacted>
Signed-off-by: Zhu Yanjun <redacted>
---
net/rds/ib_fmr.c | 5 +++--
net/rds/ib_mr.h | 2 --
2 files changed, 3 insertions(+), 4 deletions(-)
The function rds_ib_map_fmr is used only in the ib_fmr.c
file. As such, the static type is added to limit it in this file.
Cc: Joe Jin <redacted>
Cc: Junxiao Bi <redacted>
Signed-off-by: Zhu Yanjun <redacted>
---
net/rds/ib_fmr.c | 5 +++--
net/rds/ib_mr.h | 2 --
2 files changed, 3 insertions(+), 4 deletions(-)
When rdma_accept fails, rdma_reject is called in it. As such, it is
not necessary to execute rdma_reject again.
Cc: Joe Jin <redacted>
Cc: Junxiao Bi <redacted>
Signed-off-by: Zhu Yanjun <redacted>
---
net/rds/ib_cm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
@@ -677,8 +677,7 @@ int rds_ib_cm_handle_connect(struct rdma_cm_id *cm_id,event->param.conn.initiator_depth);/* rdma_accept() calls rdma_reject() internally if it fails */-err=rdma_accept(cm_id,&conn_param);-if(err)+if(rdma_accept(cm_id,&conn_param))rds_ib_conn_error(conn,"rdma_accept failed (%d)\n",err);
There are couple of consumer reject reasons needs to be conveyed.
Current code don't pass them, but downstream code has them and
hence I kept the code as is. Its good to avoid the reject on
current code so am fine with the change.
Acked-by: Santosh Shilimkar <redacted>