From: Rod Widdowson Date: Wed, 12 May 2010 14:48:25 +0000 (+0100) Subject: Clean up logging from vldb_check. X-Git-Tag: openafs-devel-1_5_75~272 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=644162ae3de315adbf6d9e3cd4d647f87174cb42;p=packages%2Fo%2Fopenafs.git Clean up logging from vldb_check. vldb_check used to say "%: Volume '' not found in hash " for two sorts of failures - If the volume really wasn't in a hash chain of that type at all - If volume's next pointer (for the hash type) pointed to a volume with a different hash. In both cases it would then print out some confusing (and spurious) information about the next element in the chain, prior to applying the same fix (of zeroing the next pointer). This change fixes the error message. Change-Id: I5eb6ae1a461628d401b997dde4bab53a0cc7571d Reviewed-on: http://gerrit.openafs.org/1955 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/vlserver/vldb_check.c b/src/vlserver/vldb_check.c index d04af3758..43c37d2ec 100644 --- a/src/vlserver/vldb_check.c +++ b/src/vlserver/vldb_check.c @@ -1166,6 +1166,7 @@ WorkerBee(struct cmd_syndesc *as, void *arock) */ if (record[i].type & VL) { int foundbad = 0; + int foundbroken = 0; char volidbuf[256]; readentry(record[i].addr, &vlentry, &type); @@ -1224,7 +1225,7 @@ WorkerBee(struct cmd_syndesc *as, void *arock) readentry(nextp, &vlentry2, &type); nexthash = NameHash(vlentry2.name); if (hash != nexthash) - foundbad = 1; + foundbroken = 1; } if ((record[ADDR(vlentry.nextIdHash[0])].type & MULTRW)) { @@ -1237,7 +1238,7 @@ WorkerBee(struct cmd_syndesc *as, void *arock) readentry(nextp, &vlentry2, &type); nexthash = IdHash(vlentry2.volumeId[0]); if (hash != nexthash) - foundbad = 1; + foundbroken = 1; } if ((record[ADDR(vlentry.nextIdHash[1])].type & MULTRO)) { @@ -1250,7 +1251,7 @@ WorkerBee(struct cmd_syndesc *as, void *arock) readentry(nextp, &vlentry2, &type); nexthash = IdHash(vlentry2.volumeId[1]); if (hash != nexthash) - foundbad = 1; + foundbroken = 1; } if ((record[ADDR(vlentry.nextIdHash[2])].type & MULTBK)) { @@ -1263,30 +1264,28 @@ WorkerBee(struct cmd_syndesc *as, void *arock) readentry(nextp, &vlentry2, &type); nexthash = IdHash(vlentry2.volumeId[2]); if (hash != nexthash) - foundbad = 1; + foundbroken = 1; } - if (foundbad) { - log_error(VLDB_CHECK_ERROR,"%d: Volume '%s' %snot found in %s hash %d", i, + if (foundbroken) { + log_error(VLDB_CHECK_ERROR, "%d: Volume '%s' %s forward link in %s is broken (hash %d != %d)", i, + vlentry.name, volidbuf, which, hash, nexthash); + } else if (foundbad) { + log_error(VLDB_CHECK_ERROR, "%d: Volume '%s' %snot found in %s hash %d", i, vlentry.name, volidbuf, which, hash); - if (nextp) { - log_error(VLDB_CHECK_ERROR," (next %d", nextp); - if (!(record[nextp].type & reft)) { - log_error(VLDB_CHECK_ERROR," not in chain "); - record[nextp].type |= reft; - } else if (nextp != 0) { - log_error(VLDB_CHECK_ERROR," next in chain"); - if (fix) { - log_error(VLDB_CHECK_ERROR,", unchaining"); - *nextpp = 0; - writeentry(record[i].addr, &vlentry); - } - } - log_error(VLDB_CHECK_ERROR,")"); + } + + if (foundbad || foundbroken) { + if (nextp && fix) { + log_error(VLDB_CHECK_ERROR, ", unchaining next (%d)\n", nextp); + *nextpp = 0; + writeentry(record[i].addr, &vlentry); + } else { + log_error(VLDB_CHECK_ERROR, "\n"); } - log_error(VLDB_CHECK_ERROR,"\n"); + } - + for (j = 0; j < NMAXNSERVERS; j++) { if ((vlentry.serverNumber[j] != 255) && (serveraddrs[vlentry.serverNumber[j]] == 0)) {