From fa9468e93aa1efaa1afcfb5a10f03d3970474775 Mon Sep 17 00:00:00 2001 From: huanghua Date: Sat, 29 Apr 2006 10:18:34 +0000 Subject: [PATCH] (1)correct the cleanup for mdt_intent_ploicy. (2)some small changes to coding style. --- lustre/mdt/mdt_handler.c | 18 +++++++++++------- lustre/mdt/mdt_lib.c | 4 ++-- lustre/mdt/mdt_reint.c | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index bec5650..3fb006d 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -283,11 +283,11 @@ static int mdt_reint(struct mdt_thread_info *info, /* NB only peek inside req now; mdt_XXX_unpack() will swab it */ if (opcp == NULL) { - CERROR ("Can't inspect opcode\n"); - RETURN (-EINVAL); + CERROR("Can't inspect opcode\n"); + RETURN(-EINVAL); } opc = *opcp; - if (lustre_msg_swabbed (req->rq_reqmsg)) + if (lustre_msg_swabbed(req->rq_reqmsg)) __swab32s(&opc); DEBUG_REQ(D_INODE, req, "reint opt = %d", opc); @@ -306,7 +306,7 @@ static int mdt_reint(struct mdt_thread_info *info, rc = lustre_pack_reply(req, info->mti_rep_buf_nr, info->mti_rep_buf_size, NULL); if (rc) - RETURN (rc); + RETURN(rc); rc = mdt_reint_internal(info, req, offset, NULL); RETURN(rc); } @@ -1068,7 +1068,7 @@ static int mdt_intent_policy(struct ldlm_namespace *ns, if (req->rq_reqmsg->bufcount <= MDS_REQ_INTENT_IT_OFF) { /* No intent was provided */ - info->mti_rep_buf_size[0] = sizeof(struct ldlm_reply); + info->mti_rep_buf_size[0] = sizeof(struct ldlm_reply); rc = lustre_pack_reply(req, 1, info->mti_rep_buf_size, NULL); LASSERT(rc == 0); mdt_thread_info_fini(info); @@ -1122,7 +1122,7 @@ static int mdt_intent_policy(struct ldlm_namespace *ns, /* XXX swab here to assert that an mds_open reint * packet is following */ rep->lock_policy_res2 = mdt_reint_internal(info, req, - offset, &lockh); + offset, &lockh); #if 0 /* We abort the lock if the lookup was negative and * we did not make it to the OPEN portion */ @@ -1184,8 +1184,10 @@ static int mdt_intent_policy(struct ldlm_namespace *ns, * the client instead of whatever lock it was about to get. */ if (new_lock == NULL) new_lock = ldlm_handle2lock(&lockh.mlh_lh); - if (new_lock == NULL && (flags & LDLM_FL_INTENT_ONLY)) + if (new_lock == NULL && (flags & LDLM_FL_INTENT_ONLY)) { + mdt_thread_info_fini(info); RETURN(0); + } LASSERTF(new_lock != NULL, "op "LPX64" lockh "LPX64"\n", it->opc, lockh.mlh_lh.cookie); @@ -1208,6 +1210,7 @@ static int mdt_intent_policy(struct ldlm_namespace *ns, * reconstructed a reply. */ LASSERT(lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT); + mdt_thread_info_fini(info); RETURN(ELDLM_LOCK_REPLACED); } @@ -1231,6 +1234,7 @@ static int mdt_intent_policy(struct ldlm_namespace *ns, LDLM_LOCK_PUT(new_lock); l_unlock(&new_lock->l_resource->lr_namespace->ns_lock); + mdt_thread_info_fini(info); RETURN(ELDLM_LOCK_REPLACED); } diff --git a/lustre/mdt/mdt_lib.c b/lustre/mdt/mdt_lib.c index 9509ef9..83dbfc6 100644 --- a/lustre/mdt/mdt_lib.c +++ b/lustre/mdt/mdt_lib.c @@ -131,12 +131,12 @@ int mdt_reint_unpack(struct mdt_thread_info *info, /* NB don't lustre_swab_reqbuf() here. We're just taking a peek * and we want to leave it to the specific unpacker once we've * identified the message type */ - opcodep = lustre_msg_buf (req->rq_reqmsg, offset, sizeof (*opcodep)); + opcodep = lustre_msg_buf(req->rq_reqmsg, offset, sizeof (*opcodep)); if (opcodep == NULL) RETURN(-EFAULT); opcode = *opcodep; - if (lustre_msg_swabbed (req->rq_reqmsg)) + if (lustre_msg_swabbed(req->rq_reqmsg)) __swab32s (&opcode); if (opcode >= REINT_MAX || mdt_reint_unpackers[opcode] == NULL) { diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index 68e0f3f..865bf61 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -164,7 +164,7 @@ int mdt_reint_rec(struct mdt_thread_info *info, int rc; ENTRY; - rc = reinters[info->mti_rr.rr_opcode] (info, lockh); + rc = reinters[info->mti_rr.rr_opcode](info, lockh); RETURN(rc); } -- 1.8.3.1