From efae60645fe9b60e2b0fc9ee82b4fe39e488f6e4 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Tue, 5 Aug 2014 11:10:10 -0500 Subject: [PATCH] LU-5452 lmv: release request in lmv_revalidate_slaves() In lmv_revalidate_slaves() ensure that the request returned by md_intent_lock() is properly released on all paths. Signed-off-by: John L. Hammond Change-Id: I35d63b248d0c80261ebc97f43722b0c547eb1aac Reviewed-on: http://review.whamcloud.com/11326 Tested-by: Jenkins Reviewed-by: wangdi Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- lustre/lmv/lmv_intent.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index 096f83a..4bd0b3c 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -159,6 +159,7 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct mdt_body *mbody, { struct obd_device *obd = exp->exp_obd; struct lmv_obd *lmv = &obd->u.lmv; + struct ptlrpc_request *req = NULL; struct mdt_body *body; struct md_op_data *op_data; unsigned long size = 0; @@ -186,7 +187,6 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct mdt_body *mbody, for (i = 0; i < lsm->lsm_md_stripe_count; i++) { struct lu_fid fid; struct lookup_intent it = { .it_op = IT_GETATTR }; - struct ptlrpc_request *req = NULL; struct lustre_handle *lockh = NULL; struct lmv_tgt_desc *tgt = NULL; struct inode *inode; @@ -210,6 +210,11 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct mdt_body *mbody, CDEBUG(D_INODE, "Revalidate slave "DFID" -> mds #%d\n", PFID(&fid), tgt->ltd_idx); + if (req != NULL) { + ptlrpc_req_finished(req); + req = NULL; + } + rc = md_intent_lock(tgt->ltd_exp, op_data, &it, &req, cb_blocking, extra_lock_flags); if (rc < 0) @@ -233,9 +238,6 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct mdt_body *mbody, PFID(&lsm->lsm_md_oinfo[i].lmo_fid), PFID(&lsm->lsm_md_oinfo[0].lmo_fid)); - if (req != NULL) - ptlrpc_req_finished(req); - if (it.d.lustre.it_lock_mode && lockh) { ldlm_lock_decref(lockh, it.d.lustre.it_lock_mode); @@ -251,9 +253,6 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct mdt_body *mbody, LTIME_S(inode->i_atime) = body->mbo_atime; LTIME_S(inode->i_ctime) = body->mbo_ctime; LTIME_S(inode->i_mtime) = body->mbo_mtime; - - if (req != NULL) - ptlrpc_req_finished(req); } md_set_lock_data(tgt->ltd_exp, &lockh->cookie, inode, NULL); @@ -297,6 +296,9 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct mdt_body *mbody, mbody->mbo_mtime = mtime; } cleanup: + if (req != NULL) + ptlrpc_req_finished(req); + OBD_FREE_PTR(op_data); RETURN(rc); } -- 1.8.3.1