Details
-
Improvement
-
Resolution: Unresolved
-
Major
-
None
-
None
-
9223372036854775807
Description
When e2fsck finds a directory that is hard-linked between an existing directory and lost+found, it appears to prefer moving the file into lost+found rather than keeping it connected to the original parent directory:
'..' in /lost+found/#471345273 (471345273) is /ROOT/RUNDIRS/2018051500/output (471373040), should be /lost+found (11). Fix? no Entry 'tmp249767' in /ROOT/RUNDIRS/2018051500/output (471373040) is a link to directory /lost+found/#471345273 (471345273 fid=[0x200039c0f:0x1d51c:0x0]). Inode 471345273 ref count is 2, should be 3. Fix? no Entry '#471345273' in /lost+found (11) has an incorrect filetype (was 1, should be 2). Fix? no
It would make more sense for e2fsck to prefer not moving files into lost+found if there is somewhere else that the inode could be attached.
I think the main obstacle to linking directory inodes back into the original parent directory (based on the inode number stored in ..) is that e2fsck would normally not know the filename. For Lustre filesystems, the correct filename can be found in a number of ways:
Being able to correctly repair the directory entry in the parent, rather than dumping all files into lost+found would avoid a considerable amount of duplicate work (add entry to lost+found, update .., fix link count, then repair it again later by OI Scrub or LFSCK). The only drawback is that this would be specific to Lustre unless we can implement trusted.link for upstream ext4 (ideally with the same on-disk format using struct link_ea_header and struct link_ea_entry, otherwise with a different xattr name and/or leh_magic).