* [PATCHv3 0/4] rds: ib: trivial patches @ 2017-03-13 5:43 Zhu Yanjun [not found] ` <1489383828-7699-1-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> ` (3 more replies) 0 siblings, 4 replies; 9+ messages in thread From: Zhu Yanjun @ 2017-03-13 5:43 UTC (permalink / raw) To: santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA, netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA, rds-devel-N0ozoZBvEnrZJqsBc5GL+g, leon-DgEjT+Ai2ygdnm+yROfE0A v2 -> v3 remove err from messages. Zhu Yanjun (4): rds: ib: drop unnecessary rdma_reject rds: ib: remove redundant ib_dealloc_fmr rds: ib: add the static type to the function rds: ib: unmap the scatter/gather list when error net/rds/ib_cm.c | 5 ++--- net/rds/ib_fmr.c | 38 ++++++++++++++++++++++++-------------- net/rds/ib_mr.h | 2 -- 3 files changed, 26 insertions(+), 19 deletions(-) -- 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <1489383828-7699-1-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>]
* [PATCHv3 1/4] rds: ib: drop unnecessary rdma_reject [not found] ` <1489383828-7699-1-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> @ 2017-03-13 5:43 ` Zhu Yanjun [not found] ` <1489383828-7699-2-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 2017-03-14 6:20 ` [PATCHv3 0/4] rds: ib: trivial patches David Miller 1 sibling, 1 reply; 9+ messages in thread From: Zhu Yanjun @ 2017-03-13 5:43 UTC (permalink / raw) To: santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA, netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA, rds-devel-N0ozoZBvEnrZJqsBc5GL+g, leon-DgEjT+Ai2ygdnm+yROfE0A When rdma_accept fails, rdma_reject is called in it. As such, it is not necessary to execute rdma_reject again. Cc: Joe Jin <joe.jin-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> Cc: Junxiao Bi <junxiao.bi-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> Acked-by: Santosh Shilimkar <santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> Signed-off-by: Zhu Yanjun <yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> --- net/rds/ib_cm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c index ce3775a..4b9405c 100644 --- a/net/rds/ib_cm.c +++ b/net/rds/ib_cm.c @@ -677,9 +677,8 @@ 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) - rds_ib_conn_error(conn, "rdma_accept failed (%d)\n", err); + if (rdma_accept(cm_id, &conn_param)) + rds_ib_conn_error(conn, "rdma_accept failed\n"); out: if (conn) -- 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 ^ permalink raw reply related [flat|nested] 9+ messages in thread
[parent not found: <1489383828-7699-2-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCHv3 1/4] rds: ib: drop unnecessary rdma_reject [not found] ` <1489383828-7699-2-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> @ 2017-03-13 6:32 ` Leon Romanovsky [not found] ` <20170313063224.GJ2079-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Leon Romanovsky @ 2017-03-13 6:32 UTC (permalink / raw) To: Zhu Yanjun Cc: santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA, netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA, rds-devel-N0ozoZBvEnrZJqsBc5GL+g [-- Attachment #1: Type: text/plain, Size: 1658 bytes --] On Mon, Mar 13, 2017 at 01:43:45AM -0400, Zhu Yanjun wrote: > When rdma_accept fails, rdma_reject is called in it. As such, it is > not necessary to execute rdma_reject again. It is not always correct, according to the code, rdma_accept can fail and will return EINVAL and skip calling to rdma_reject. 3725 int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) 3726 { 3727 struct rdma_id_private *id_priv; 3728 int ret; 3729 3730 id_priv = container_of(id, struct rdma_id_private, id); 3731 3732 id_priv->owner = task_pid_nr(current); 3733 3734 if (!cma_comp(id_priv, RDMA_CM_CONNECT)) 3735 return -EINVAL; 3736 > > Cc: Joe Jin <joe.jin-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> > Cc: Junxiao Bi <junxiao.bi-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> > Acked-by: Santosh Shilimkar <santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> > Signed-off-by: Zhu Yanjun <yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> > --- > net/rds/ib_cm.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c > index ce3775a..4b9405c 100644 > --- a/net/rds/ib_cm.c > +++ b/net/rds/ib_cm.c > @@ -677,9 +677,8 @@ 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) > - rds_ib_conn_error(conn, "rdma_accept failed (%d)\n", err); > + if (rdma_accept(cm_id, &conn_param)) > + rds_ib_conn_error(conn, "rdma_accept failed\n"); > > out: > if (conn) > -- > 2.7.4 > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <20170313063224.GJ2079-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>]
* Re: [PATCHv3 1/4] rds: ib: drop unnecessary rdma_reject [not found] ` <20170313063224.GJ2079-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org> @ 2017-03-13 6:41 ` Yanjun Zhu [not found] ` <58C63F06.6090804-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Yanjun Zhu @ 2017-03-13 6:41 UTC (permalink / raw) To: Leon Romanovsky Cc: santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA, netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA, rds-devel-N0ozoZBvEnrZJqsBc5GL+g On 2017/3/13 14:32, Leon Romanovsky wrote: > On Mon, Mar 13, 2017 at 01:43:45AM -0400, Zhu Yanjun wrote: >> When rdma_accept fails, rdma_reject is called in it. As such, it is >> not necessary to execute rdma_reject again. > It is not always correct, according to the code, rdma_accept can fail > and will return EINVAL and skip calling to rdma_reject. Sure. When -EINVAL is returned, By this function cma_comp(id_priv, RDMA_CM_CONNECT), the connection is lost. As such, it does not matter whether sending rdma_reject or not. Zhu Yanjun > > 3725 int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) > 3726 { > 3727 struct rdma_id_private *id_priv; > 3728 int ret; > 3729 > 3730 id_priv = container_of(id, struct rdma_id_private, id); > 3731 > 3732 id_priv->owner = task_pid_nr(current); > 3733 > 3734 if (!cma_comp(id_priv, RDMA_CM_CONNECT)) > 3735 return -EINVAL; > 3736 > > >> Cc: Joe Jin <joe.jin-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> >> Cc: Junxiao Bi <junxiao.bi-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> >> Acked-by: Santosh Shilimkar <santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> >> Signed-off-by: Zhu Yanjun <yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> >> --- >> net/rds/ib_cm.c | 5 ++--- >> 1 file changed, 2 insertions(+), 3 deletions(-) >> >> diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c >> index ce3775a..4b9405c 100644 >> --- a/net/rds/ib_cm.c >> +++ b/net/rds/ib_cm.c >> @@ -677,9 +677,8 @@ 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) >> - rds_ib_conn_error(conn, "rdma_accept failed (%d)\n", err); >> + if (rdma_accept(cm_id, &conn_param)) >> + rds_ib_conn_error(conn, "rdma_accept failed\n"); >> >> out: >> if (conn) >> -- >> 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <58C63F06.6090804-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCHv3 1/4] rds: ib: drop unnecessary rdma_reject [not found] ` <58C63F06.6090804-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> @ 2017-03-13 9:23 ` Leon Romanovsky 0 siblings, 0 replies; 9+ messages in thread From: Leon Romanovsky @ 2017-03-13 9:23 UTC (permalink / raw) To: Yanjun Zhu Cc: santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA, netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA, rds-devel-N0ozoZBvEnrZJqsBc5GL+g [-- Attachment #1: Type: text/plain, Size: 2182 bytes --] On Mon, Mar 13, 2017 at 02:41:10PM +0800, Yanjun Zhu wrote: > > > On 2017/3/13 14:32, Leon Romanovsky wrote: > > On Mon, Mar 13, 2017 at 01:43:45AM -0400, Zhu Yanjun wrote: > > > When rdma_accept fails, rdma_reject is called in it. As such, it is > > > not necessary to execute rdma_reject again. > > It is not always correct, according to the code, rdma_accept can fail > > and will return EINVAL and skip calling to rdma_reject. > Sure. When -EINVAL is returned, By this function cma_comp(id_priv, > RDMA_CM_CONNECT), the connection > is lost. As such, it does not matter whether sending rdma_reject or not. Thanks for the explanation.. > > Zhu Yanjun > > > > 3725 int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) > > 3726 { > > 3727 struct rdma_id_private *id_priv; > > 3728 int ret; > > 3729 > > 3730 id_priv = container_of(id, struct rdma_id_private, id); > > 3731 > > 3732 id_priv->owner = task_pid_nr(current); > > 3733 > > 3734 if (!cma_comp(id_priv, RDMA_CM_CONNECT)) > > 3735 return -EINVAL; > > 3736 > > > > > > > Cc: Joe Jin <joe.jin-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> > > > Cc: Junxiao Bi <junxiao.bi-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> > > > Acked-by: Santosh Shilimkar <santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> > > > Signed-off-by: Zhu Yanjun <yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> > > > --- > > > net/rds/ib_cm.c | 5 ++--- > > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > > > diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c > > > index ce3775a..4b9405c 100644 > > > --- a/net/rds/ib_cm.c > > > +++ b/net/rds/ib_cm.c > > > @@ -677,9 +677,8 @@ 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) > > > - rds_ib_conn_error(conn, "rdma_accept failed (%d)\n", err); > > > + if (rdma_accept(cm_id, &conn_param)) > > > + rds_ib_conn_error(conn, "rdma_accept failed\n"); > > > > > > out: > > > if (conn) > > > -- > > > 2.7.4 > > > > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCHv3 0/4] rds: ib: trivial patches [not found] ` <1489383828-7699-1-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 2017-03-13 5:43 ` [PATCHv3 1/4] rds: ib: drop unnecessary rdma_reject Zhu Yanjun @ 2017-03-14 6:20 ` David Miller 1 sibling, 0 replies; 9+ messages in thread From: David Miller @ 2017-03-14 6:20 UTC (permalink / raw) To: yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA Cc: santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA, netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA, rds-devel-N0ozoZBvEnrZJqsBc5GL+g, leon-DgEjT+Ai2ygdnm+yROfE0A From: Zhu Yanjun <yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> Date: Mon, 13 Mar 2017 01:43:44 -0400 > v2 -> v3 > remove err from messages. > > Zhu Yanjun (4): > rds: ib: drop unnecessary rdma_reject > rds: ib: remove redundant ib_dealloc_fmr > rds: ib: add the static type to the function > rds: ib: unmap the scatter/gather list when error Series applied to net-next, thanks. -- 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCHv3 2/4] rds: ib: remove redundant ib_dealloc_fmr 2017-03-13 5:43 [PATCHv3 0/4] rds: ib: trivial patches Zhu Yanjun [not found] ` <1489383828-7699-1-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> @ 2017-03-13 5:43 ` Zhu Yanjun 2017-03-13 5:43 ` [PATCHv3 3/4] rds: ib: add the static type to the function Zhu Yanjun 2017-03-13 5:43 ` [PATCHv3 4/4] rds: ib: unmap the scatter/gather list when error Zhu Yanjun 3 siblings, 0 replies; 9+ messages in thread From: Zhu Yanjun @ 2017-03-13 5:43 UTC (permalink / raw) To: santosh.shilimkar, netdev, linux-rdma, rds-devel, leon The function ib_dealloc_fmr will never be called. As such, it should be removed. Cc: Joe Jin <joe.jin@oracle.com> Cc: Junxiao Bi <junxiao.bi@oracle.com> Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com> --- net/rds/ib_fmr.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/net/rds/ib_fmr.c b/net/rds/ib_fmr.c index 4fe8f4f..249ae1c 100644 --- a/net/rds/ib_fmr.c +++ b/net/rds/ib_fmr.c @@ -78,12 +78,9 @@ struct rds_ib_mr *rds_ib_alloc_fmr(struct rds_ib_device *rds_ibdev, int npages) return ibmr; out_no_cigar: - if (ibmr) { - if (fmr->fmr) - ib_dealloc_fmr(fmr->fmr); - kfree(ibmr); - } + kfree(ibmr); atomic_dec(&pool->item_count); + return ERR_PTR(err); } -- 2.7.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCHv3 3/4] rds: ib: add the static type to the function 2017-03-13 5:43 [PATCHv3 0/4] rds: ib: trivial patches Zhu Yanjun [not found] ` <1489383828-7699-1-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 2017-03-13 5:43 ` [PATCHv3 2/4] rds: ib: remove redundant ib_dealloc_fmr Zhu Yanjun @ 2017-03-13 5:43 ` Zhu Yanjun 2017-03-13 5:43 ` [PATCHv3 4/4] rds: ib: unmap the scatter/gather list when error Zhu Yanjun 3 siblings, 0 replies; 9+ messages in thread From: Zhu Yanjun @ 2017-03-13 5:43 UTC (permalink / raw) To: santosh.shilimkar, netdev, linux-rdma, rds-devel, leon 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 <joe.jin@oracle.com> Cc: Junxiao Bi <junxiao.bi@oracle.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com> --- net/rds/ib_fmr.c | 5 +++-- net/rds/ib_mr.h | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/net/rds/ib_fmr.c b/net/rds/ib_fmr.c index 249ae1c..c936b0d 100644 --- a/net/rds/ib_fmr.c +++ b/net/rds/ib_fmr.c @@ -84,8 +84,9 @@ struct rds_ib_mr *rds_ib_alloc_fmr(struct rds_ib_device *rds_ibdev, int npages) return ERR_PTR(err); } -int rds_ib_map_fmr(struct rds_ib_device *rds_ibdev, struct rds_ib_mr *ibmr, - struct scatterlist *sg, unsigned int nents) +static int rds_ib_map_fmr(struct rds_ib_device *rds_ibdev, + struct rds_ib_mr *ibmr, struct scatterlist *sg, + unsigned int nents) { struct ib_device *dev = rds_ibdev->dev; struct rds_ib_fmr *fmr = &ibmr->u.fmr; diff --git a/net/rds/ib_mr.h b/net/rds/ib_mr.h index 5d6e98a..0ea4ab0 100644 --- a/net/rds/ib_mr.h +++ b/net/rds/ib_mr.h @@ -125,8 +125,6 @@ void rds_ib_mr_exit(void); void __rds_ib_teardown_mr(struct rds_ib_mr *); void rds_ib_teardown_mr(struct rds_ib_mr *); struct rds_ib_mr *rds_ib_alloc_fmr(struct rds_ib_device *, int); -int rds_ib_map_fmr(struct rds_ib_device *, struct rds_ib_mr *, - struct scatterlist *, unsigned int); struct rds_ib_mr *rds_ib_reuse_mr(struct rds_ib_mr_pool *); int rds_ib_flush_mr_pool(struct rds_ib_mr_pool *, int, struct rds_ib_mr **); struct rds_ib_mr *rds_ib_reg_fmr(struct rds_ib_device *, struct scatterlist *, -- 2.7.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCHv3 4/4] rds: ib: unmap the scatter/gather list when error 2017-03-13 5:43 [PATCHv3 0/4] rds: ib: trivial patches Zhu Yanjun ` (2 preceding siblings ...) 2017-03-13 5:43 ` [PATCHv3 3/4] rds: ib: add the static type to the function Zhu Yanjun @ 2017-03-13 5:43 ` Zhu Yanjun 3 siblings, 0 replies; 9+ messages in thread From: Zhu Yanjun @ 2017-03-13 5:43 UTC (permalink / raw) To: santosh.shilimkar, netdev, linux-rdma, rds-devel, leon When some errors occur, the scatter/gather list mapped to DMA addresses should be handled. Cc: Joe Jin <joe.jin@oracle.com> Cc: Junxiao Bi <junxiao.bi@oracle.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com> --- net/rds/ib_fmr.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/net/rds/ib_fmr.c b/net/rds/ib_fmr.c index c936b0d..86ef907 100644 --- a/net/rds/ib_fmr.c +++ b/net/rds/ib_fmr.c @@ -112,29 +112,39 @@ static int rds_ib_map_fmr(struct rds_ib_device *rds_ibdev, u64 dma_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) { @@ -147,8 +157,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); goto out; + } /* Success - we successfully remapped the MR, so we can * safely tear down the old mapping. -- 2.7.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-03-14 6:20 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-03-13 5:43 [PATCHv3 0/4] rds: ib: trivial patches Zhu Yanjun [not found] ` <1489383828-7699-1-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 2017-03-13 5:43 ` [PATCHv3 1/4] rds: ib: drop unnecessary rdma_reject Zhu Yanjun [not found] ` <1489383828-7699-2-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 2017-03-13 6:32 ` Leon Romanovsky [not found] ` <20170313063224.GJ2079-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org> 2017-03-13 6:41 ` Yanjun Zhu [not found] ` <58C63F06.6090804-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 2017-03-13 9:23 ` Leon Romanovsky 2017-03-14 6:20 ` [PATCHv3 0/4] rds: ib: trivial patches David Miller 2017-03-13 5:43 ` [PATCHv3 2/4] rds: ib: remove redundant ib_dealloc_fmr Zhu Yanjun 2017-03-13 5:43 ` [PATCHv3 3/4] rds: ib: add the static type to the function Zhu Yanjun 2017-03-13 5:43 ` [PATCHv3 4/4] rds: ib: unmap the scatter/gather list when error Zhu Yanjun
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.