mbox series

[0/2] ext4: fix inline data / extent status truncation bug

Message ID 20210819144927.25163-1-enwlinux@gmail.com
Headers show
Series ext4: fix inline data / extent status truncation bug | expand

Message

Eric Whitney Aug. 19, 2021, 2:49 p.m. UTC
If ext4 converts an inline file to extents when applying writes under
delayed allocation that exceed the available inline storage, one or
more delayed allocated extents may be stored in the extent status cache
with an accompanying increase in the reserved block count.  If the file
is subsequently truncated before writeback occurs, that inode's delayed
allocated extents will not be removed from the extent status cache and
the reserved block count will not be reduced as required after
truncation. At minimum, unexpected ENOSPC conditions can occur.

Eric Whitney (2):
  ext4: remove extent cache entries when truncating inline data
  ext4: enforce buffer head state assertion in ext4_da_map_blocks

 fs/ext4/inline.c | 19 +++++++++++++++++++
 fs/ext4/inode.c  | 15 +++++++++------
 2 files changed, 28 insertions(+), 6 deletions(-)

Comments

Theodore Ts'o Sept. 9, 2021, 2:55 p.m. UTC | #1
On Thu, 19 Aug 2021 10:49:25 -0400, Eric Whitney wrote:
> If ext4 converts an inline file to extents when applying writes under
> delayed allocation that exceed the available inline storage, one or
> more delayed allocated extents may be stored in the extent status cache
> with an accompanying increase in the reserved block count.  If the file
> is subsequently truncated before writeback occurs, that inode's delayed
> allocated extents will not be removed from the extent status cache and
> the reserved block count will not be reduced as required after
> truncation. At minimum, unexpected ENOSPC conditions can occur.
> 
> [...]

Applied, thanks!

[1/2] ext4: remove extent cache entries when truncating inline data
      commit: 0add491df4e5e2c8cc6eeeaa6dbcca50f932090c
[2/2] ext4: enforce buffer head state assertion in ext4_da_map_blocks
      commit: 948ca5f30e1df0c11eb5b0f410b9ceb97fa77ad9

Best regards,