Fixed bug where globals were poisoning move commits

The issue lies in the reuse of the id field for globals. Before globals,
the only tags with a non-null (0x3ff) id field were names, structs, and
other file-specific metadata. But globals are also using this field for
the indirect delete, since otherwise the globals structure would be very
unaligned (74-bits long).

To make matters worse, the id field for globals contains the delta used
to reconstruct the globals at mount time. Which means the id field could
take on very absurd values and break the dir fetch logic if we're not
careful.

Solution is to use the scope portion of the type field where necessary,
although unforunately this does add some code cost.
This commit is contained in:
Christopher Haster
2018-07-08 14:21:29 -05:00
parent b46fcac585
commit 2ff32d2dfb
3 changed files with 57 additions and 13 deletions

2
lfs.h
View File

@@ -129,7 +129,7 @@ enum lfs_type {
// internal sources
LFS_FROM_REGION = 0x000,
LFS_FROM_DISK = 0x200,
LFS_FROM_MOVE = 0x0ff,
LFS_FROM_MOVE = 0x03f,
};
// File open flags