Commit f77c4839 authored by Guoqing Jiang's avatar Guoqing Jiang Committed by Jason Gunthorpe

RDMA/rtrs-srv: Jump to dereg_mr label if allocate iu fails

The rtrs_iu_free is called in rtrs_iu_alloc if memory is limited, so we
don't need to free the same iu again.

Fixes: 9cb83748 ("RDMA/rtrs: server: main functionality")
Link: https://lore.kernel.org/r/20201217141915.56989-7-jinpu.wang@cloud.ionos.comSigned-off-by: default avatarGuoqing Jiang <guoqing.jiang@cloud.ionos.com>
Reviewed-by: default avatarGioh Kim <gi-oh.kim@cloud.ionos.com>
Signed-off-by: default avatarJack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent f47e4e3e
...@@ -651,7 +651,7 @@ static int map_cont_bufs(struct rtrs_srv_sess *sess) ...@@ -651,7 +651,7 @@ static int map_cont_bufs(struct rtrs_srv_sess *sess)
if (!srv_mr->iu) { if (!srv_mr->iu) {
err = -ENOMEM; err = -ENOMEM;
rtrs_err(ss, "rtrs_iu_alloc(), err: %d\n", err); rtrs_err(ss, "rtrs_iu_alloc(), err: %d\n", err);
goto free_iu; goto dereg_mr;
} }
} }
/* Eventually dma addr for each chunk can be cached */ /* Eventually dma addr for each chunk can be cached */
...@@ -667,7 +667,6 @@ static int map_cont_bufs(struct rtrs_srv_sess *sess) ...@@ -667,7 +667,6 @@ static int map_cont_bufs(struct rtrs_srv_sess *sess)
srv_mr = &sess->mrs[mri]; srv_mr = &sess->mrs[mri];
sgt = &srv_mr->sgt; sgt = &srv_mr->sgt;
mr = srv_mr->mr; mr = srv_mr->mr;
free_iu:
rtrs_iu_free(srv_mr->iu, sess->s.dev->ib_dev, 1); rtrs_iu_free(srv_mr->iu, sess->s.dev->ib_dev, 1);
dereg_mr: dereg_mr:
ib_dereg_mr(mr); ib_dereg_mr(mr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment