Whamcloud - gitweb
LU-3707 target: fix trans call back for out 56/7256/3
authorwang di <di.wang@intel.com>
Tue, 6 Aug 2013 19:34:15 +0000 (12:34 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 17 Aug 2013 05:19:39 +0000 (05:19 +0000)
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 <di.wang@intel.com>
Change-Id: I8eee17645487a3a3eced6862743bc35b83fc2c24
Reviewed-on: http://review.whamcloud.com/7256
Tested-by: Hudson
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/lu_target.h
lustre/mdt/mdt_recovery.c
lustre/target/tgt_lastrcvd.c

index 2dab5cb..f87f8ce 100644 (file)
@@ -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
 };
index 3a67cdf..3f5babd 100644 (file)
@@ -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)) {
index 4bf52f0..88dd030 100644 (file)
@@ -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);
+