f2fs: add sanity check on ei.len in __update_extent_tree_range()
Chao Yu
maintainerPATCH 1/1 f2fs: add sanity check on ei.len in __update_extent_tree_range()
Add a sanity check in __update_extent_tree_range() to detect any zero-sized extent update.
--- fs/f2fs/extent_cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/f2fs/extent_cache.c +9 -0
@@ -664,6 +664,15 @@ static void __update_extent_tree_range(struct inode *inode,if (!et)return ; +if (unlikely (len ==0 )) { +f2fs_err_ratelimited (sbi,"%s: extent len is zero, type: %d, " +"extent [%u, %u, %u], age [%llu, %llu]" , + __func__, type, tei->fofs, tei->blk, tei->len, + tei->age, tei->last_blocks); +f2fs_bug_on (sbi,1 ); +return ; + } +if (type ==EX_READ )trace_f2fs_update_read_extent_tree_range (inode, fofs, len, tei->blk,0 );
Signature · 1 line
2.49.0
Jaegeuk Kim
maintainerDo we need this?
Quoted 31 lines · Chao Yu
Add a sanity check in
__update_extent_tree_range()to detect any zero-sized extent update.Signed-off-by wangzijie <[email protected]>Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/extent_cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)fs/f2fs/extent_cache.c +9
-0@@ -664,6 +664,15 @@ static void __update_extent_tree_range(struct inode *inode,if (!et)return ; +if (unlikely (len ==0 )) { +f2fs_err_ratelimited (sbi,"%s: extent len is zero, type: %d, " +"extent [%u, %u, %u], age [%llu, %llu]" , + __func__, type, tei->fofs, tei->blk, tei->len, + tei->age, tei->last_blocks); +f2fs_bug_on (sbi,1 ); +return ; + } +if (type ==EX_READ )trace_f2fs_update_read_extent_tree_range (inode, fofs, len, tei->blk,0 );Signature · 1 line
2.49.0
Chao Yu
maintainerQuoted 1 line · Jaegeuk Kim
Do we need this?
I think so, it can provide a way to dump more information to troubleshoot in which function we're trying to update w/ a zero-sized extent.
Thanks,
Quoted 33 lines · Chao Yu
Quoted 31 lines
Add a sanity check in
__update_extent_tree_range()to detect any zero-sized extent update.Signed-off-by wangzijie <[email protected]>Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/extent_cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)fs/f2fs/extent_cache.c +9
-0@@ -664,6 +664,15 @@ static void __update_extent_tree_range(struct inode *inode,if (!et)return ; +if (unlikely (len ==0 )) { +f2fs_err_ratelimited (sbi,"%s: extent len is zero, type: %d, " +"extent [%u, %u, %u], age [%llu, %llu]" , + __func__, type, tei->fofs, tei->blk, tei->len, + tei->age, tei->last_blocks); +f2fs_bug_on (sbi,1 ); +return ; + } +if (type ==EX_READ )trace_f2fs_update_read_extent_tree_range (inode, fofs, len, tei->blk,0 );Signature · 1 line
2.49.0
This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <[email protected]>:
Hello:
This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:
Quoted 8 lines · On Tue, 16 Sep 2025 16:52:43 +0800 you wrote:
Add a sanity check in
__update_extent_tree_range()to detect any zero-sized extent update.Signed-off-by wangzijie <[email protected]>Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/extent_cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)
Here is the summary with links:
- [f2fs-dev] f2fs: add sanity check on ei.len in __update_extent_tree_range()
https://git.kernel.org/jaegeuk/f2fs/c/45b70947a425
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html