

Make jfsck() rewrite the lockfile to save the new maximum transaction ID.
Otherwise, when we try to rollback, we could step over some transaction file
we want to recover, or face a corrupt lockfile.



---

 cur-root/libjio.c |    7 +++++++
 1 files changed, 7 insertions(+)

diff -puN libjio.c~jfsck_rewrite_lockfile libjio.c
--- cur/libjio.c~jfsck_rewrite_lockfile	2004-05-05 15:08:22.000000000 -0300
+++ cur-root/libjio.c	2004-05-05 15:08:22.000000000 -0300
@@ -735,6 +735,13 @@ int jfsck(const char *name, struct jfsck
 	}
 	closedir(dir);
 
+	/* rewrite the lockfile, writing the new maxtid on it, so that when we
+	 * rollback a transaction it doesn't step over existing ones */
+	rv = spwrite(fs.jfd, &maxtid, sizeof(maxtid), 0);
+	if (rv != sizeof(maxtid)) {
+		return J_ENOMEM;
+	}
+
 	/* we loop all the way up to the max transaction id */
 	for (i = 1; i <= maxtid; i++) {
 		curts = malloc(sizeof(struct jtrans));

_
