]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ext4: make ext4_es_lookup_extent() pass out the extent seq counter
authorZhang Yi <yi.zhang@huawei.com>
Mon, 13 Oct 2025 01:51:19 +0000 (09:51 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 6 Nov 2025 15:44:39 +0000 (10:44 -0500)
commit7da5565cab4069b2b171dbfa7554b596a7fdf827
treed9f48d9cfff92f62a170cbdfc563c5d2763a19ae
parentdd064d5101ea473d39c39ffaa8beeb8f47bbeb09
ext4: make ext4_es_lookup_extent() pass out the extent seq counter

When querying extents in the extent status tree, we should hold the
data_sem if we want to obtain the sequence number as a valid cookie
simultaneously. However, currently, ext4_map_blocks() calls
ext4_es_lookup_extent() without holding data_sem. Therefore, we should
acquire i_es_lock instead, which also ensures that the sequence cookie
and the extent remain consistent. Consequently, make
ext4_es_lookup_extent() to pass out the sequence number when necessary.

Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Message-ID: <20251013015128.499308-4-yi.zhang@huaweicloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/extents.c
fs/ext4/extents_status.c
fs/ext4/extents_status.h
fs/ext4/inode.c