Reworked decisions to undo related to unreadable records

When an INDX or MFT record could not be read while undoing the creation
of this record, there is nothing to do. However if this was undoing the
deletion of the last entry in an index, a new void index block has to be
created.
This commit is contained in:
Jean-Pierre André 2016-04-06 08:44:38 +02:00
parent 6b5e47f094
commit 8fc9c96305

View File

@ -4731,10 +4731,16 @@ printf("record lsn 0x%llx is %s than action %d lsn 0x%llx\n",
err = 1; err = 1;
} }
} else { } else {
/* Undoing a record create which was not done ? */ /*
// TODO make sure this is about a newly allocated record (with bad fixup) * Could not read the MFT record :
// TODO check this is inputting a full record (record lth == data lth) * if this is undoing a record create (from scratch)
buffer = (char*)calloc(1, mftrecsz); * which did not take place, there is nothing to redo,
* otherwise this is an error.
*/
if (check_full_mft(action,TRUE))
executed = FALSE;
else
err = 1;
} }
break; break;
case ON_INDX : case ON_INDX :
@ -4765,13 +4771,28 @@ printf("index lsn 0x%llx is %s than action %d lsn 0x%llx\n",
err = 1; err = 1;
} }
} else { } else {
/* Undoing a record create which was not done ? */ /*
// TODO make sure this is about a newly allocated record (with bad fixup) * Could not read the INDX record :
// TODO check this is inputting a full record (record lth == data lth) * if this is undoing a record create (from scratch)
// recreate an INDX record if this is the first entry * which did not take place, there is nothing to redo,
buffer = (char*)calloc(1, xsize); * otherwise this must be an error.
err = create_indx(vol, action, buffer); * However, after deleting the last index allocation
executed = TRUE; * in a block, the block is apparently zeroed
* and cannot be read. In this case we have to
* create an initial index block and apply the undo.
*/
if (check_full_index(action,TRUE))
executed = FALSE;
else {
err = 1;
if (uop == AddIndexEntryAllocation) {
executed = TRUE;
buffer = (char*)calloc(1, xsize);
if (buffer)
err = create_indx(vol,
action, buffer);
}
}
} }
break; break;
case ON_RAW : case ON_RAW :