Whamcloud - gitweb
LU-3707 target: fix trans call back for out
[fs/lustre-release.git] / lustre / target / tgt_lastrcvd.c
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);
+