From b717cd5bb2745a7100dc534cff5263d39e43af14 Mon Sep 17 00:00:00 2001
From: rread <rread>
Date: Thu, 22 Jul 2004 16:30:26 +0000
Subject: [PATCH] b=2525

I've seen the "server went back in time" message while testing HEAD,
so this will fix that.  Patch already on 1.4.
---
 lustre/mds/mds_fs.c           |  6 ++++++
 lustre/obdfilter/filter.c     |  4 ++++
 lustre/tests/replay-single.sh | 21 +++++++++++++++++++++
 3 files changed, 31 insertions(+)

diff --git a/lustre/mds/mds_fs.c b/lustre/mds/mds_fs.c
index e32ba3fcc8..38654a5d1b 100644
--- a/lustre/mds/mds_fs.c
+++ b/lustre/mds/mds_fs.c
@@ -167,6 +167,12 @@ int mds_client_free(struct obd_export *exp, int clear_client)
                 LBUG();
         }
 
+
+        /* Make sure the server's last_transno is up to date. Do this
+         * after the client is freed so we know all the client's
+         * transactions have been committed. */
+        mds_update_server_data(exp->exp_obd, 1);
+
  free_and_out:
         OBD_FREE(med->med_mcd, sizeof(*med->med_mcd));
 
diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c
index 8fe771e65b..b464c7b106 100644
--- a/lustre/obdfilter/filter.c
+++ b/lustre/obdfilter/filter.c
@@ -263,6 +263,10 @@ static int filter_client_free(struct obd_export *exp, int flags)
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         rc = fsfilt_write_record(obd, filter->fo_rcvd_filp, &zero_fcd,
                                  sizeof(zero_fcd), &off, 1);
+        if (rc == 0)
+                /* update server's transno */
+                filter_update_server_data(obd, filter->fo_rcvd_filp,
+                                          filter->fo_fsd, 1);
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
 
         CDEBUG(rc == 0 ? D_INFO : D_ERROR,
diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh
index 2a6cddb303..271b242293 100755
--- a/lustre/tests/replay-single.sh
+++ b/lustre/tests/replay-single.sh
@@ -956,6 +956,27 @@ test_47() {
 }
 run_test 47 "MDS->OSC failure during precreate cleanup (2824)"
 
+
+test_48() {
+    createmany -o $DIR/${tfile}- 100
+    $CHECKSTAT $DIR/${tfile}-99 || return 1
+    mds_evict_client
+    df $MOUNT || df $MOUNT || return 2
+    sleep 1
+    $CHECKSTAT $DIR/${tfile}-99 || return 3
+
+    dmesg -c >/dev/null
+    replay_barrier mds1
+    fail mds1
+    unlinkmany $DIR/${tfile}- 100 || return 4
+    if dmesg | grep "back in time"; then 
+	echo "server went back in time!"
+	return 5
+    fi
+    return 0
+}
+run_test 48 "Don't lose transno when client is evicted (2525)"
+
 equals_msg test complete, cleaning up
 $CLEANUP
 
-- 
GitLab