diff options
author | Chris Wilson <chris+github@qwirx.com> | 2013-08-22 00:31:57 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2013-08-22 00:31:57 +0000 |
commit | 212e13971ee6ad34d159ace13e73af230ad0a944 (patch) | |
tree | 735c86a1241b8681182947387621245382deeb7d | |
parent | 711ac679ce0788ec778986dbc377b344a2e25d01 (diff) |
Improve debugging messages after repairing a directory.
Report whether the directory still had errors after the first pass of
dir.CheckAndFix(), and also whether a file is marked as both Old and
Deleted, which means that its block usage is not accounted for anywhere.
There's possibly still a bug here where an invalid directory entry that
is itself a directory may not result in the parent directory being marked
as isModified and written back out afterwards, which may be what's
happening to Markus Grunwald (failure to correct the error with "check fix").
-rw-r--r-- | lib/backupstore/BackupStoreCheck.cpp | 84 |
1 files changed, 54 insertions, 30 deletions
diff --git a/lib/backupstore/BackupStoreCheck.cpp b/lib/backupstore/BackupStoreCheck.cpp index 4530b9dd..4ed783c8 100644 --- a/lib/backupstore/BackupStoreCheck.cpp +++ b/lib/backupstore/BackupStoreCheck.cpp @@ -653,20 +653,21 @@ void BackupStoreCheck::CheckDirectories() *en, pblock->mID[e], iIndex, isModified); } + // Item can't be found. Is it a directory? + else if(en->IsDir()) + { + // Store the directory for later attention + mDirsWhichContainLostDirs[en->GetObjectID()] = pblock->mID[e]; + } else { - // Item can't be found. Is it a directory? - if(en->IsDir()) - { - // Store the directory for later attention - mDirsWhichContainLostDirs[en->GetObjectID()] = pblock->mID[e]; - } - else - { - // Just remove the entry - badEntry = true; - BOX_WARNING("Directory ID " << BOX_FORMAT_OBJECTID(pblock->mID[e]) << " references object " << BOX_FORMAT_OBJECTID(en->GetObjectID()) << " which does not exist."); - } + // Just remove the entry + badEntry = true; + BOX_WARNING("Directory ID " << + BOX_FORMAT_OBJECTID(pblock->mID[e]) << + " references object " << + BOX_FORMAT_OBJECTID(en->GetObjectID()) << + " which does not exist."); } // Is this entry worth keeping? @@ -674,22 +675,31 @@ void BackupStoreCheck::CheckDirectories() { toDelete.push_back(en->GetObjectID()); } - else if (en->IsFile()) + else if(!en->IsFile()) + { + BOX_TRACE("Not counting object " << + BOX_FORMAT_OBJECTID(en->GetObjectID()) << + " with flags " << en->GetFlags()); + } + else // it's a good file, add to sizes + if(en->IsOld() && en->IsDeleted()) + { + BOX_WARNING("File " << + BOX_FORMAT_OBJECTID(en->GetObjectID()) << + " is both old and deleted, " + "this should not happen!"); + } + else if(en->IsOld()) + { + mBlocksInOldFiles += en->GetSizeInBlocks(); + } + else if(en->IsDeleted()) + { + mBlocksInDeletedFiles += en->GetSizeInBlocks(); + } + else { - // Add to sizes? - if(en->IsOld()) - { - mBlocksInOldFiles += en->GetSizeInBlocks(); - } - if(en->IsDeleted()) - { - mBlocksInDeletedFiles += en->GetSizeInBlocks(); - } - if(!en->IsOld() && - !en->IsDeleted()) - { - mBlocksInCurrentFiles += en->GetSizeInBlocks(); - } + mBlocksInCurrentFiles += en->GetSizeInBlocks(); } } @@ -704,11 +714,25 @@ void BackupStoreCheck::CheckDirectories() // Mark as modified isModified = true; - // Check the directory again, now that entries have been removed - dir.CheckAndFix(); - // Errors found ++mNumberErrorsFound; + + // Check the directory again, now that entries have been removed + if(dir.CheckAndFix()) + { + // Wasn't quite right, and has been modified + BOX_WARNING("Directory ID " << + BOX_FORMAT_OBJECTID(pblock->mID[e]) << + " was still bad after first pass"); + ++mNumberErrorsFound; + isModified = true; + } + else + { + BOX_INFO("Directory ID " << + BOX_FORMAT_OBJECTID(pblock->mID[e]) << + " was OK after fixing"); + } } if(isModified && mFixErrors) |