public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] ext4: Fix regression in mballoc due to deleted inode PAs in rbtree
@ 2023-07-22 17:15 Ojaswin Mujoo
  2023-07-22 17:15 ` [PATCH 1/1] ext4: Fix rbtree traversal bug in ext4_mb_use_preallocated Ojaswin Mujoo
  2023-07-23 12:32 ` [PATCH 0/1] ext4: Fix regression in mballoc due to deleted inode PAs in rbtree Theodore Ts'o
  0 siblings, 2 replies; 3+ messages in thread
From: Ojaswin Mujoo @ 2023-07-22 17:15 UTC (permalink / raw)
  To: linux-ext4, Theodore Ts'o
  Cc: Ritesh Harjani, linux-kernel, Jan Kara, Naresh Kamboju

Hello,

Recently there was a regression found in the mballoc [1] due the existence
of deleted preallocations(PAs) in the per inode preallocation rbtree.
Such deleted PAs can occur because ext4_mb_discard_group_preallocations 
traverses the grp->bb_prealloc_list and marks the PAs as deleted without
taking any inode specific locks like i_data_sem. 

Due to presence of such PAs, we were sometimes missing some of the pa
entries when traversing the per node rbtree in ext4_mb_use_preallocated.
Due to this, in some rare conditions we ended up missing a PA that did
overlap with our original request start. when this happens, we exit 
ext4_mb_use_preallocated and proceed with the allocation. However,
during ext4_mb_normalize_request() we were hitting a bug on as
a PA that could satisfy our request already existed. Since normalize
request was already fixed earlier to account for the deleted PAs we
actually able to catch it there.

This patch aims to fix this regression by using a different appraoch to
traverse the rbtree in ext4_mb_use_preallocated(). More comments can be
found in the commit message.

We've run several overnight runs of xfstests generic/269 as well as
several hours of ltp test on both x86 machines with 4k blocks size and
Power machines with 64k and 4k block size and have yet to hit the
regression. Further we added some debug prints in our testing to make
sure we were correctly handling the conditions that were triggering the
bug ons previously.

[1]
https://lore.kernel.org/linux-ext4/CA+G9fYv2FRpLqBZf34ZinR8bU2_ZRAUOjKAD3+tKRFaEQHtt8Q@mail.gmail.com/

Regards,
ojaswin

Ojaswin Mujoo (1):
  ext4: Fix rbtree traversal bug in ext4_mb_use_preallocated

 fs/ext4/mballoc.c | 158 ++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 131 insertions(+), 27 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-23 12:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-22 17:15 [PATCH 0/1] ext4: Fix regression in mballoc due to deleted inode PAs in rbtree Ojaswin Mujoo
2023-07-22 17:15 ` [PATCH 1/1] ext4: Fix rbtree traversal bug in ext4_mb_use_preallocated Ojaswin Mujoo
2023-07-23 12:32 ` [PATCH 0/1] ext4: Fix regression in mballoc due to deleted inode PAs in rbtree Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox