From ed4e8ed4c172f6b442ac41b06fe63de38231ab87 Mon Sep 17 00:00:00 2001 From: Alexander Boyko Date: Mon, 3 Apr 2017 14:35:53 +0300 Subject: [PATCH] LU-9286 ptlrpc: fix wrong error handlers If ptlrpc_request_pack finish with 0, we need to call ptlrpc_req_finished for later errors. Signed-off-by: Alexander Boyko Seagate-bug-id: MRP-4285 Change-Id: I97dec565c1aa95c4457b32cb5d72b4f8abdd3d1d Reviewed-on: https://review.whamcloud.com/26319 Tested-by: Jenkins Reviewed-by: Chris Horn Reviewed-by: Mike Pershin Tested-by: Maloo Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin --- lustre/mdc/mdc_request.c | 2 +- lustre/osc/osc_request.c | 2 +- lustre/osp/osp_object.c | 6 ++---- lustre/quota/qsd_request.c | 6 ++---- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index fd811e1..418453a 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -900,7 +900,7 @@ restart_bulk: MDS_BULK_PORTAL, &ptlrpc_bulk_kiov_pin_ops); if (desc == NULL) { - ptlrpc_request_free(req); + ptlrpc_req_finished(req); RETURN(-ENOMEM); } diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index d2086a1..3c4150a 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -650,7 +650,7 @@ static int osc_destroy(const struct lu_env *env, struct obd_export *exp, rc = l_wait_event_exclusive(cli->cl_destroy_waitq, osc_can_send_destroy(cli), &lwi); if (rc) { - ptlrpc_request_free(req); + ptlrpc_req_finished(req); RETURN(rc); } } diff --git a/lustre/osp/osp_object.c b/lustre/osp/osp_object.c index fc823e3..e0e0073 100644 --- a/lustre/osp/osp_object.c +++ b/lustre/osp/osp_object.c @@ -1737,10 +1737,8 @@ static int osp_it_fetch(const struct lu_env *env, struct osp_it *it) PTLRPC_BULK_PUT_SINK | PTLRPC_BULK_BUF_KIOV, MDS_BULK_PORTAL, &ptlrpc_bulk_kiov_pin_ops); - if (desc == NULL) { - ptlrpc_request_free(req); - RETURN(-ENOMEM); - } + if (desc == NULL) + GOTO(out, rc = -ENOMEM); for (i = 0; i < npages; i++) desc->bd_frag_ops->add_kiov_frag(desc, pages[i], 0, diff --git a/lustre/quota/qsd_request.c b/lustre/quota/qsd_request.c index dca5af3..152ba90 100644 --- a/lustre/quota/qsd_request.c +++ b/lustre/quota/qsd_request.c @@ -392,10 +392,8 @@ int qsd_fetch_index(const struct lu_env *env, struct obd_export *exp, PTLRPC_BULK_PUT_SINK | PTLRPC_BULK_BUF_KIOV, MDS_BULK_PORTAL, &ptlrpc_bulk_kiov_pin_ops); - if (desc == NULL) { - ptlrpc_request_free(req); - RETURN(-ENOMEM); - } + if (desc == NULL) + GOTO(out, rc = -ENOMEM); /* req now owns desc and will free it when it gets freed */ for (i = 0; i < npages; i++) -- 1.8.3.1