[OpenAFS-devel] 1.8 ubik/remote.c

Hartmut Reuter hartmut.reuter@gmx.de
Sun, 21 Jan 2018 10:38:27 +0100


In openafs 1.8 in ubik/remote.c you will end up with a database labeled "0.0" in
the case we found out that the host the new database should come from is not the
one we have the connection to. Keep the old version in tversion and epoch to
restore it if actually we didn't get a new database.

--- remote.c.orig       2018-01-03 06:56:08.000000000 +0100
+++ remote.c    2018-01-20 17:52:58.222611247 +0100
@@ -460,6 +460,8 @@
     /* send the file back to the requester */
 
     dbase = ubik_dbase;
+    memcpy(&tversion, &dbase->version, sizeof(struct ubik_version));
+    epoch = tversion.epoch;    /* Keep th current version to restore it later */
     pbuffer[0] = '\0';
 
     if ((code = ubik_CheckAuth(rxcall))) {
@@ -498,7 +500,7 @@
 
     offset = 0;
     UBIK_VERSION_LOCK;
-    epoch = tversion.epoch = 0;                /* start off by labelling
in-transit db as invalid */
+    tversion.epoch = 0;                /* start off by labelling in-transit db
as invalid */
     (*dbase->setlabel) (dbase, file, &tversion);       /* setlabel does sync */
     snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP",
             ubik_dbase->pathName, (file<0)?"SYS":"",