From 607905a789357a34166f34e7c992b03f5040eafc Mon Sep 17 00:00:00 2001 From: wang di Date: Tue, 6 Aug 2013 12:34:15 -0700 Subject: [PATCH] LU-3707 target: fix trans call back for out Since OUT and MDT share the same trans callback route path, move mti_has_trans from mdt_thread_info to tgt_session_info, so avoid confusing out transaction. Test-Parameters: mdtcount=2 mdscount=2 Signed-off-by: wang di Change-Id: I8eee17645487a3a3eced6862743bc35b83fc2c24 Reviewed-on: http://review.whamcloud.com/7256 Tested-by: Hudson Reviewed-by: Mike Pershin Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- lustre/include/lu_target.h | 3 ++- lustre/mdt/mdt_recovery.c | 9 --------- lustre/target/tgt_lastrcvd.c | 13 +++++++++++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/lustre/include/lu_target.h b/lustre/include/lu_target.h index 2dab5cb..f87f8ce 100644 --- a/lustre/include/lu_target.h +++ b/lustre/include/lu_target.h @@ -99,6 +99,8 @@ struct tgt_session_info { */ int tsi_reply_fail_id; int tsi_request_fail_id; + + __u32 tsi_has_trans:1; /* has txn already? */ }; static inline struct tgt_session_info *tgt_ses_info(const struct lu_env *env) @@ -251,7 +253,6 @@ int tgt_truncate_last_rcvd(const struct lu_env *env, struct lu_target *tg, int tgt_last_rcvd_update(const struct lu_env *env, struct lu_target *tgt, struct dt_object *obj, __u64 opdata, struct thandle *th, struct ptlrpc_request *req); - enum { ESERIOUS = 0x0001000 }; diff --git a/lustre/mdt/mdt_recovery.c b/lustre/mdt/mdt_recovery.c index 3a67cdf..3f5babd 100644 --- a/lustre/mdt/mdt_recovery.c +++ b/lustre/mdt/mdt_recovery.c @@ -402,15 +402,6 @@ static int mdt_txn_stop_cb(const struct lu_env *env, mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key); LASSERT(mti); - if (mti->mti_has_trans) { - /* XXX: currently there are allowed cases, but the wrong cases - * are also possible, so better check is needed here */ - CDEBUG(D_INFO, "More than one transaction "LPU64"\n", - mti->mti_transno); - return 0; - } - - mti->mti_has_trans = 1; if (mti->mti_mos != NULL && mdt_object_remote(mti->mti_mos)) { diff --git a/lustre/target/tgt_lastrcvd.c b/lustre/target/tgt_lastrcvd.c index 4bf52f0..88dd030 100644 --- a/lustre/target/tgt_lastrcvd.c +++ b/lustre/target/tgt_lastrcvd.c @@ -693,6 +693,7 @@ int tgt_last_rcvd_update(const struct lu_env *env, struct lu_target *tgt, struct thandle *th, struct ptlrpc_request *req) { struct tgt_thread_info *tti = tgt_th_info(env); + struct tgt_session_info *tsi = tgt_ses_info(env); struct tg_export_data *ted; __u64 *transno_p; int rc = 0; @@ -700,10 +701,17 @@ int tgt_last_rcvd_update(const struct lu_env *env, struct lu_target *tgt, ENTRY; + if (tsi->tsi_has_trans) { + /* XXX: currently there are allowed cases, but the wrong cases + * are also possible, so better check is needed here */ + CDEBUG(D_INFO, "More than one transaction "LPU64"\n", + tti->tti_transno); + return 0; + } + + tsi->tsi_has_trans = 1; /* that can be OUT target and we need tgt_session_info */ if (req == NULL) { - struct tgt_session_info *tsi = tgt_ses_info(env); - req = tgt_ses_req(tsi); if (req == NULL) /* echo client case */ RETURN(0); @@ -830,3 +838,4 @@ srv_update: return rc; } EXPORT_SYMBOL(tgt_last_rcvd_update); + -- 1.8.3.1