vol-salvage: Only delete bad vnodes during !check

In SalvageIndex, if check is true, we're only supposed to check for
consistency and not actually change anything (this is enforced by an
assert later on). The check for vnode magic consistency breaks this
assumption, and just always fixes the vnode.

Change this so we just error out if check is set, and the vnode magic
is wrong.

Change-Id: I9e2d3bd5e9e340a9b2ac66d70d52aa110b512561
Reviewed-on: http://gerrit.openafs.org/3756
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Andrew Deason 2011-01-25 10:46:38 -06:00 committed by Derrick Brashear
parent 14f5466eee
commit 5817a13b84

View File

@ -2572,6 +2572,14 @@ SalvageIndex(struct SalvInfo *salvinfo, Inode ino, VnodeClass class, int RW,
} else {
if (vcp->magic != vnode->vnodeMagic) {
/* bad magic #, probably partially created vnode */
if (check) {
Log("Partially allocated vnode %d: bad magic (is %lx should be %lx)\n",
vnodeNumber, afs_printable_uint32_lu(vnode->vnodeMagic),
afs_printable_uint32_lu(vcp->magic));
memset(vnode, 0, vcp->diskSize);
err = -1;
goto zooks;
}
Log("Partially allocated vnode %d deleted.\n",
vnodeNumber);
memset(vnode, 0, vcp->diskSize);