On 2021/10/8 0:37, Theodore Ts'o wrote: > On Wed, Sep 08, 2021 at 08:08:49PM +0800, Zhang Yi wrote: >> Now that we can check out overlapping extents in leaf block and >> out-of-order index extents in index block. But the .ee_block in the >> first extent of one leaf block should equal to the .ei_block in it's >> parent index extent entry. > > I don't believe this is always guaranteed. > > The punch hole operation can remove some or part of the first entry in > the leaf block, and it won't update the parent index. So it's OK for > the first entry of the leaf block to be greater than entry in the > parent block. However, if the first entry of the leaf block is less > than the entry in the parent block, that's definitely going to be a > problem. > Hi, Ted. ext4_punch_hole()->ext4_ext_remove_space()->ext4_ext_rm_leaf() call ext4_ext_correct_indexes() or ext4_ext_rm_idx() to update the parent index if the removing extent entry is the first entry of the leaf block. static int ext4_ext_rm_leaf(handle_t *handle, struct inode *inode, struct ext4_ext_path *path, struct partial_cluster *partial, ext4_lblk_t start, ext4_lblk_t end) { ... if (ex == EXT_FIRST_EXTENT(eh)) { correct_index = 1; ... if (correct_index && eh->eh_entries) err = ext4_ext_correct_indexes(handle, inode, path); ... } static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode, struct ext4_ext_path *path, int depth) { ... while (--depth >= 0) { ... path->p_idx->ei_block = (path+1)->p_idx->ei_block; ... } ... } And the fsck does also check the mismatch case in scan_extent_node(), am I missing something? Thanks, Yi.