Whamcloud - gitweb
LU-3749 recovery: save versions from reply into lastrcvd
[fs/lustre-release.git] / lustre / target / tgt_lastrcvd.c
index 4bf52f0..2694aaa 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);
@@ -780,7 +788,7 @@ int tgt_last_rcvd_update(const struct lu_env *env, struct lu_target *tgt,
                ted->ted_lcd->lcd_last_close_result = th->th_result;
        } else {
                /* VBR: save versions in last_rcvd for reconstruct. */
-               __u64 *pre_versions = lustre_msg_get_versions(req->rq_reqmsg);
+               __u64 *pre_versions = lustre_msg_get_versions(req->rq_repmsg);
 
                if (pre_versions) {
                        ted->ted_lcd->lcd_pre_versions[0] = pre_versions[0];
@@ -830,3 +838,4 @@ srv_update:
        return rc;
 }
 EXPORT_SYMBOL(tgt_last_rcvd_update);
+