Patch "btrfs: properly limit inline data extent according to block size" has been added to the 6.12-stable tree
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Sasha Levin
This is a note to let you know that I've just added the patch titled
btrfs: properly limit inline data extent according to block size
to the 6.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
Quoted 6 lines
The filename of the patch is:
btrfs-properly-limit-inline-data-extent-according-to.patch
and it can be found in the queue-6.12 subdirectory.If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Please drop this patch from all stable trees.
This is only for a debug feature, 2K block size, and it will never be exposed to end users (only to allow people without a 64K page sized system to test subpage routine on x86_64).
Thanks,
Qu
Quoted 68 lines
commit
a5afc96d757771c992eb3af4629a562ec52ba1dcAuthor: Qu Wenruo <[email protected]> Date: Tue Feb 25 14:30:44 2025 +1030btrfs: properly limit inline data extent according to block size
[ Upstream commit
23019d3e6617a8ec99a8d2f5947aa3dd8a74a1b8]Btrfs utilizes inline data extent for the following cases:
- Regular small files
- SymlinksAnd "btrfs check" detects any file extents that are too large as an error.
It's not a problem for 4K block size, but for the incoming smaller block sizes (2K), it can cause problems due to bad limits:
- Non-compressed inline data extents
We do not allow a non-compressed inline data extent to be as large as block size.- Symlinks
Currently the only real limit on symlinks are 4K, which can be larger than 2K block size.These will result btrfs-check to report too large file extents.
Fix it by adding proper size checks for the above cases.
Signed-off-by Qu Wenruo <[email protected]>Reviewed-by David Sterba <[email protected]>Signed-off-by David Sterba <[email protected]>Signed-off-by Sasha Levin <[email protected]>fs/btrfs/inode.c +10
-1@@ -623,6 +623,10 @@ static bool can_cow_file_range_inline(struct btrfs_inode *inode,if (size > fs_info->sectorsize)return false; +/* We do not allow a non-compressed extent to be as large as block size. */ +if (data_len >= fs_info->sectorsize) +return false; +/* We cannot exceed the maximum inline data size. */ if (data_len >BTRFS_MAX_INLINE_DATA_SIZE (fs_info))return false;@@ -8691,7 +8695,12 @@ static int btrfs_symlink(struct mnt_idmap *idmap, struct inode *dir,struct extent_buffer *leaf; name_len =strlen (symname); -if (name_len >BTRFS_MAX_INLINE_DATA_SIZE (fs_info)) +/* +* Symlinks utilize uncompressed inline extent data, which should not +* reach block size. +*/ +if (name_len >BTRFS_MAX_INLINE_DATA_SIZE (fs_info) || + name_len >= fs_info->sectorsize)return -ENAMETOOLONG ; inode =new_inode (dir->i_sb);
Greg KH
maintainerQuoted 14 lines · Qu Wenruo
Quoted 11 lines · Sasha Levin
This is a note to let you know that I've just added the patch titled
btrfs: properly limit inline data extent according to block size
to the 6.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summaryThe filename of the patch is:
btrfs-properly-limit-inline-data-extent-according-to.patch
and it can be found in the queue-6.12 subdirectory.
Quoted 8 lines
Quoted 2 lines
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Please drop this patch from all stable trees.
This is only for a debug feature, 2K block size, and it will never be exposed to end users (only to allow people without a 64K page sized system to test subpage routine on
x86_64).
Now dropped, thanks.
greg k-h