RDMA/rxe: Fix qp error handler
Subsystems (2)
PATCH 1/1 RDMA/rxe: Fix qp error handler
From: Zhu Yanjun <[email protected]>
Move the qp error handler to be near the rxe_create_qp.
--- drivers/infiniband/sw/rxe/rxe_qp.c | 14 ++++++++++---- drivers/infiniband/sw/rxe/rxe_verbs.c | 1 - 2 files changed, 10 insertions(+), 5 deletions(-)
drivers/infiniband/sw/rxe/rxe_qp.c +10 -4
@@ -220,8 +220,7 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp, &qp->sq.queue->ip);if (err) { -vfree (qp->sq.queue->buf); -kfree (qp->sq.queue); +rxe_queue_cleanup (qp->sq.queue); qp->sq.queue =NULL ;return err; }
@@ -277,8 +276,7 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct rxe_qp *qp, qp->rq.queue->buf, qp->rq.queue->buf_size, &qp->rq.queue->ip);if (err) { -vfree (qp->rq.queue->buf); -kfree (qp->rq.queue); +rxe_queue_cleanup (qp->rq.queue); qp->rq.queue =NULL ;return err; }
@@ -341,6 +339,14 @@ int rxe_qp_from_init(struct rxe_dev *rxe, struct rxe_qp *qp, struct rxe_pd *pd,return 0 ; err2: +if (qp_type (qp) ==IB_QPT_RC ) { +del_timer_sync (&qp->retrans_timer); +del_timer_sync (&qp->rnr_nak_timer); + } + +rxe_cleanup_task (&qp->req.task); +rxe_cleanup_task (&qp->comp.task); +rxe_queue_cleanup (qp->sq.queue); qp->sq.queue =NULL ; err1:
drivers/infiniband/sw/rxe/rxe_verbs.c +0 -1
@@ -432,7 +432,6 @@ static int rxe_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init,return 0 ; qp_init: -rxe_put (qp);return err; }
Signature · 1 line
2.31.1
Quoted 56 lines · On Wed, May 25, 2022 at 12:28 PM <[email protected]> wrote:
From: Zhu Yanjun <[email protected]>
Move the qp error handler to be near the
rxe_create_qp.Reported-by [email protected]Signed-off-by Zhu Yanjun <[email protected]>--- drivers/infiniband/sw/rxe/rxe_qp.c | 14 ++++++++++---- drivers/infiniband/sw/rxe/rxe_verbs.c | 1 - 2 files changed, 10 insertions(+), 5 deletions(-)drivers/infiniband/sw/rxe/rxe_qp.c +10
-4@@ -220,8 +220,7 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp, &qp->sq.queue->ip);if (err) { -vfree (qp->sq.queue->buf); -kfree (qp->sq.queue); +rxe_queue_cleanup (qp->sq.queue); qp->sq.queue =NULL ;return err; }@@ -277,8 +276,7 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct rxe_qp *qp, qp->rq.queue->buf, qp->rq.queue->buf_size, &qp->rq.queue->ip);if (err) { -vfree (qp->rq.queue->buf); -kfree (qp->rq.queue); +rxe_queue_cleanup (qp->rq.queue); qp->rq.queue =NULL ;return err; }@@ -341,6 +339,14 @@ int rxe_qp_from_init(struct rxe_dev *rxe, struct rxe_qp *qp, struct rxe_pd *pd,return 0 ; err2: +if (qp_type (qp) ==IB_QPT_RC ) { +del_timer_sync (&qp->retrans_timer); +del_timer_sync (&qp->rnr_nak_timer); + } + +rxe_cleanup_task (&qp->req.task); +rxe_cleanup_task (&qp->comp.task); +rxe_queue_cleanup (qp->sq.queue); qp->sq.queue =NULL ; err1:drivers/infiniband/sw/rxe/rxe_verbs.c +0
-0
drivers/infiniband/sw/rxe/rxe_verbs.c static int rxe_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init, · line 435
Quoted 4 lines
drivers/infiniband/sw/rxe/rxe_verbs.c +0
-1@@ -432,7 +432,6 @@ static int rxe_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init,return 0 ; qp_init: -rxe_put (qp);
Does this mean that in case rxe_qp_init_resp fails (rxe_qp_init_req had succeeded), we will NOT end up calling rxe_qp_do_cleanup? If so, would we miss shutting down and releasing qp->sk?
Quoted 6 lines
drivers/infiniband/sw/rxe/rxe_verbs.c +0
-1return err; } --2.31.1
Jason Gunthorpe
maintainerQuoted 7 lines · Haris Iqbal
Quoted 7 lines
drivers/infiniband/sw/rxe/rxe_verbs.c +0
-0@@ -432,7 +432,6 @@ static int rxe_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init,return 0 ;
Quoted 6 lines
drivers/infiniband/sw/rxe/rxe_verbs.c static int rxe_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init, · line 435
Quoted 2 lines
drivers/infiniband/sw/rxe/rxe_verbs.c +0
-1qp_init: -rxe_put (qp);Does this mean that in case
rxe_qp_init_respfails (rxe_qp_init_reqhad succeeded), we will NOT end up callingrxe_qp_do_cleanup? If so, would we miss shutting down and releasingqp->sk?
Zhu??
Jason
Quoted 8 lines · Jason Gunthorpe
Quoted 7 lines · Haris Iqbal
Quoted 7 lines
drivers/infiniband/sw/rxe/rxe_verbs.c +0
-0@@ -432,7 +432,6 @@ static int rxe_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init,return 0 ;
Quoted 6 lines
Quoted 5 lines
drivers/infiniband/sw/rxe/rxe_verbs.c static int rxe_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init, · line 435
Quoted 2 lines
drivers/infiniband/sw/rxe/rxe_verbs.c +0
-1qp_init: -rxe_put (qp);Does this mean that in case
rxe_qp_init_respfails (rxe_qp_init_reqhad succeeded), we will NOT end up callingrxe_qp_do_cleanup? If so, would we miss shutting down and releasingqp->sk?Zhu??
The latest commit will come very soon.
Zhu Yanjun
Quoted 2 lines
Jason