Rebuild the vldb free chain in addition to the hash chains when
vldb_check is run with the -fix option. Print a FIX: message for
entries added to the free chain.
Example vldb with a broken free chain.
$ vldb_check vldb.broken
address 199364 (offset 0x30b04): Free vlentry not on free chain
address 223192 (offset 0x36818): Free vlentry not on free chain
address 235180 (offset 0x396ec): Free vlentry not on free chain
Scanning 1707 entries for possible repairs
$ vldb_check -fix vldb.broken
Rebuilding 1707 entries
FIX: Putting free entry on the free chain: addr=199364 (offset 0x30b04)
FIX: Putting free entry on the free chain: addr=223192 (offset 0x36818)
FIX: Putting free entry on the free chain: addr=235180 (offset 0x396ec)
Thanks to Kostas Liakakis for reporting this bug.
Reviewed-on: http://gerrit.openafs.org/11598
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit
3b9d52b2e8020cce65d55516db36580d58a51f0b)
Change-Id: I01987451857b26fb9e87984da85976196145e1dd
Reviewed-on: http://gerrit.openafs.org/12084
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
if (fix) {
/*
- * If we are fixing we will rebuild all the hash lists from the ground up
+ * If we are fixing we will rebuild the free and hash lists from the ground up.
*/
+ header.vital_header.freePtr = 0;
memcpy(oldnamehash, header.VolnameHash, sizeof(oldnamehash));
memset(header.VolnameHash, 0, sizeof(header.VolnameHash));
}
writeMH(record[i].addr, block, MHblock);
}
+ } else if (record[i].type & FR) {
+ if (fix) {
+ readentry(record[i].addr, &vlentry, &type);
+ vlentry.nextIdHash[0] = header.vital_header.freePtr;
+ header.vital_header.freePtr = record[i].addr;
+ if ((record[i].type & FRC) == 0) {
+ quiet_println
+ ("FIX: Putting free entry on the free chain: addr=%lu (offset 0x%0x)\n",
+ record[i].addr, OFFSET(record[i].addr));
+ }
+ writeentry(record[i].addr, &vlentry);
+ }
}
}
if (fix) {