From 5817a13b84496c087b350be50c17a8b0f9aac9d5 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Tue, 25 Jan 2011 10:46:38 -0600 Subject: [PATCH] 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 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/vol/vol-salvage.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/vol/vol-salvage.c b/src/vol/vol-salvage.c index b02d7b6bda..5f80744168 100644 --- a/src/vol/vol-salvage.c +++ b/src/vol/vol-salvage.c @@ -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);