android_kernel_motorola_sm6375/fs/ext4
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ojaswin Mujoo 8659c5f4ff ext4: Fix best extent lstart adjustment logic in ext4_mb_new_inode_pa()
[ Upstream commit 93cdf49f6eca5e23f6546b8f28457b2e6a6961d9 ]

When the length of best extent found is less than the length of goal extent
we need to make sure that the best extent atleast covers the start of the
original request. This is done by adjusting the ac_b_ex.fe_logical (logical
start) of the extent.

While doing so, the current logic sometimes results in the best extent's
logical range overflowing the goal extent. Since this best extent is later
added to the inode preallocation list, we have a possibility of introducing
overlapping preallocations. This is discussed in detail here [1].

As per Jan's suggestion, to fix this, replace the existing logic with the
below logic for adjusting best extent as it keeps fragmentation in check
while ensuring logical range of best extent doesn't overflow out of goal
extent:

1. Check if best extent can be kept at end of goal range and still cover
   original start.
2. Else, check if best extent can be kept at start of goal range and still
   cover original start.
3. Else, keep the best extent at start of original request.

Also, add a few extra BUG_ONs that might help catch errors faster.

[1] https://lore.kernel.org/r/[email protected]

Suggested-by: Jan Kara <[email protected]>
Signed-off-by: Ojaswin Mujoo <[email protected]>
Reviewed-by: Ritesh Harjani (IBM) <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Link: https://lore.kernel.org/r/f96aca6d415b36d1f90db86c1a8cd7e2e9d7ab0e.1679731817.git.ojaswin@linux.ibm.com
Signed-off-by: Theodore Ts'o <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
2023-05-30 12:44:03 +01:00
..
acl.c
acl.h
balloc.c ext4: fix WARNING in mb_find_extent 2023-05-17 11:36:02 +02:00
bitmap.c
block_validity.c
dir.c
ext4.h ext4: add EXT4_IGET_BAD flag to prevent unexpected bad inode 2023-01-18 11:41:51 +01:00
ext4_extents.h
ext4_jbd2.c
ext4_jbd2.h
extents.c ext4: fix use-after-free read in ext4_find_extent for bigalloc + inline 2023-05-17 11:35:53 +02:00
extents_status.c ext4: fix data races when using cached status extents 2023-05-17 11:36:03 +02:00
extents_status.h
file.c ext4: avoid crash when inline data creation follows DIO write 2022-10-26 13:22:18 +02:00
fsmap.c ext4: fix another off-by-one fsmap error on 1k block filesystems 2023-03-17 08:32:48 +01:00
fsmap.h
fsync.c
hash.c
ialloc.c ext4: make directory inode spreading reflect flexbg size 2022-09-28 11:04:11 +02:00
indirect.c ext4: fix error code return to user-space in ext4_get_branch() 2023-01-18 11:41:52 +01:00
inline.c ext4: bail out of ext4_xattr_ibody_get() fails for any reason 2023-05-17 11:36:03 +02:00
inode.c ext4: fix kernel BUG in 'ext4_write_inline_data_end()' 2023-04-05 11:16:46 +02:00
ioctl.c ext4: zero i_disksize when initializing the bootloader inode 2023-03-17 08:32:48 +01:00
Kconfig
Makefile
mballoc.c ext4: Fix best extent lstart adjustment logic in ext4_mb_new_inode_pa() 2023-05-30 12:44:03 +01:00
mballoc.h
migrate.c ext4: fix warning in 'ext4_da_release_space' 2022-11-10 17:57:56 +01:00
mmp.c
move_extent.c
namei.c ext4: fix possible double unlock when moving a directory 2023-03-22 13:28:08 +01:00
page-io.c ext4: fix cgroup writeback accounting with fs-layer encryption 2023-03-22 13:28:03 +01:00
readpage.c
resize.c ext4: fix corruption when online resizing a 1K bigalloc fs 2023-01-18 11:41:51 +01:00
super.c ext4: improve error recovery code paths in __ext4_remount() 2023-05-17 11:36:03 +02:00
symlink.c
sysfs.c ext4: Fix function prototype mismatch for ext4_feat_ktype 2023-02-25 11:53:27 +01:00
truncate.h
verity.c fs: ext4: initialize fsdata in pagecache_write() 2023-01-18 11:41:55 +01:00
xattr.c ext4: fix invalid free tracking in ext4_xattr_move_to_block() 2023-05-17 11:36:03 +02:00
xattr.h ext4: remove duplicate definition of ext4_xattr_ibody_inline_set() 2023-04-26 11:24:05 +02:00
xattr_security.c
xattr_trusted.c
xattr_user.c