]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
vldb_check: rebuild free list with -fix
authorMichael Meffie <mmeffie@sinenomine.net>
Sat, 8 Nov 2014 18:14:27 +0000 (13:14 -0500)
committerStephan Wiesand <stephan.wiesand@desy.de>
Sat, 14 Nov 2015 16:17:46 +0000 (11:17 -0500)
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>
src/vlserver/vldb_check.c

index 59f75d8ecf6a86c5de84b52deb76597c1cfb6ff8..55d851859048cd69246cdd286e00fd0414d96017 100644 (file)
@@ -1433,8 +1433,9 @@ WorkerBee(struct cmd_syndesc *as, void *arock)
 
     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));
 
@@ -1589,6 +1590,18 @@ WorkerBee(struct cmd_syndesc *as, void *arock)
                }
                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) {