* BlockAllocator::CheckNextNode() did enter an endless loop if it experienced
problems iterating over a B+tree (due to corruption). * For now, it will stop the check process when this happens, but we definitely need to be able to fix broken B+trees in the future. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35794 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1374,13 +1374,13 @@ BlockAllocator::CheckNextNode(check_control* control)
|
|||||||
fTarget(userTarget)
|
fTarget(userTarget)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
~CopyControlOnExit()
|
~CopyControlOnExit()
|
||||||
{
|
{
|
||||||
if (fTarget != NULL)
|
if (fTarget != NULL)
|
||||||
user_memcpy(fTarget, fSource, sizeof(check_control));
|
user_memcpy(fTarget, fSource, sizeof(check_control));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
check_control* fSource;
|
check_control* fSource;
|
||||||
check_control* fTarget;
|
check_control* fTarget;
|
||||||
@@ -1451,8 +1451,8 @@ BlockAllocator::CheckNextNode(check_control* control)
|
|||||||
|
|
||||||
status_t status = fCheckCookie->iterator->GetNextEntry(name, &length,
|
status_t status = fCheckCookie->iterator->GetNextEntry(name, &length,
|
||||||
B_FILE_NAME_LENGTH, &id);
|
B_FILE_NAME_LENGTH, &id);
|
||||||
if (status == B_ENTRY_NOT_FOUND) {
|
if (status != B_OK) {
|
||||||
// there are no more entries in this iterator, free it and go on
|
// we no longer need this iterator
|
||||||
delete fCheckCookie->iterator;
|
delete fCheckCookie->iterator;
|
||||||
fCheckCookie->iterator = NULL;
|
fCheckCookie->iterator = NULL;
|
||||||
|
|
||||||
@@ -1460,8 +1460,18 @@ BlockAllocator::CheckNextNode(check_control* control)
|
|||||||
put_vnode(fVolume->FSVolume(),
|
put_vnode(fVolume->FSVolume(),
|
||||||
fVolume->ToVnode(fCheckCookie->current));
|
fVolume->ToVnode(fCheckCookie->current));
|
||||||
|
|
||||||
continue;
|
if (status == B_ENTRY_NOT_FOUND) {
|
||||||
} else if (status == B_OK) {
|
// We iterated over all entries already, just go on to the next
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iterating over the B+tree failed - we let the checkfs run
|
||||||
|
// fail completely, as we would delete all files we cannot
|
||||||
|
// access.
|
||||||
|
// TODO: maybe have a force parameter that actually does that.
|
||||||
|
// TODO: we also need to be able to repair broken B+trees!
|
||||||
|
return status;
|
||||||
|
} else {
|
||||||
// ignore "." and ".." entries
|
// ignore "." and ".." entries
|
||||||
if (!strcmp(name, ".") || !strcmp(name, ".."))
|
if (!strcmp(name, ".") || !strcmp(name, ".."))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user