Skip to content

[bugfix] disable htree for /lost+found#9

Merged
liulanzheng merged 1 commit intodata-accelerator:masterfrom
WaberZhuang:master
Apr 1, 2026
Merged

[bugfix] disable htree for /lost+found#9
liulanzheng merged 1 commit intodata-accelerator:masterfrom
WaberZhuang:master

Conversation

@WaberZhuang
Copy link
Copy Markdown

@WaberZhuang WaberZhuang commented Mar 31, 2026

e2fsck reports HTREE directory errors on converted extfs images:

sudo e2fsck -nfv /dev/sda
...
Pass 2: Checking directory structure
Problem in HTREE directory inode 11: block #2 not referenced
Invalid HTREE directory inode 11 (/lost+found).  Clear HTree index?

The root cause is in photon::fs::make_extfs() -> mkdir_lost_found(), which calls ext2fs_expand_dir() twice to ensure at least 2 blocks:

for (int i = 0; i < 2; i++) {
    ret = ext2fs_expand_dir(fs, ino);
}

The first call creates a hash-indexed (HTREE) directory. However, ext2fs_expand_dir() is not designed to be called again on an HTREE directory -- HTREE growth uses a separate implementation path. The second call corrupts the directory structure by failing to properly extend the hash tree.

Fix this by disabling HTREE for the lost+found directory when opening the filesystem.

Signed-off-by: zhuangbowei.zbw <zhuangbowei.zbw@alibaba-inc.com>
@liulanzheng liulanzheng merged commit 4eeafdd into data-accelerator:master Apr 1, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants