From: Andrew Deason Date: Wed, 24 Nov 2010 14:36:05 +0000 (-0500) Subject: ubik: Replay the transaction log label correctly X-Git-Tag: upstream/1.8.0_pre1^2~4452 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=1e8598b334b4354a3998b1e5fe189f3f33957048;p=packages%2Fo%2Fopenafs.git ubik: Replay the transaction log label correctly Commit eec0d94f519b3e27f255b9b7a637df043951424e fixed the transaction replay log code to correctly identify valid transaction logs on little-endian systems, but missed ntohl'ing the database label read in a LOGEND opcode. Fix that, so the database is labelled correctly when replayed from a transaction log. And while we're here, actually pass a struct ubik_version* to adbase->setlabel, to make it a little more clear what's happening. Change-Id: I7edc33a4539f3b2fa342335c08f958b5dfb97f57 Reviewed-on: http://gerrit.openafs.org/3384 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/ubik/recovery.c b/src/ubik/recovery.c index 8e84ca5b1..89f3843fa 100644 --- a/src/ubik/recovery.c +++ b/src/ubik/recovery.c @@ -277,13 +277,16 @@ ReplayLog(struct ubik_dbase *adbase) } else if (opcode == LOGABORT) panic("log abort\n"); else if (opcode == LOGEND) { + struct ubik_version version; tpos += 4; code = (*adbase->read) (adbase, LOGFILE, (char *)buffer, tpos, 2 * sizeof(afs_int32)); if (code != 2 * sizeof(afs_int32)) return UBADLOG; - code = (*adbase->setlabel) (adbase, 0, (ubik_version *)buffer); + version.epoch = ntohl(buffer[0]); + version.counter = ntohl(buffer[1]); + code = (*adbase->setlabel) (adbase, 0, &version); if (code) return code; logIsGood = 1;