Skip to content

BUG:dir_idx in lwext which is used by libext #1361

@Luca-Cliver

Description

@Luca-Cliver

I attempted to create a large number of files using libext to test the directory indexing mechanism. However, when the number of files exceeded a certain threshold, the file system threw an error indicating a mismatch between the limit and entry_space fields in the directory entry block.The code in the screenshot is part of the dir_dx_get_leaf function, and I added a debug print statement to it.

Image

Image

This indicates that the limit is larger than expected. I found the issue in the function where the directory index block is split.

Image

Here, node_limit is computed before subtracting the space for the checksum tail, making it too large when meta_csum is enabled.The commented line of code is my fix. When validation is enabled, I recalculate the space here and then write the limit. This resolves the issue mentioned earlier. I only captured one part in the screenshot, but in reality, there are two places where this occurs. The two child index blocks created during the split both have this issue.

I believe this solution is more appropriate. I kindly request the senior developers to review it. If the issue was caused by an error on my part, I would be grateful if you could point it out. Apologies for taking up your time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions