public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix a BUG_ON crashing the kernel in start_this_handle
@ 2025-02-22  8:40 Ojaswin Mujoo
  2025-02-22  8:40 ` [PATCH 1/2] ext4: only defer sb update on error if SB_ACTIVE Ojaswin Mujoo
  2025-02-22  8:40 ` [PATCH 2/2] ext4: Make sb update interval tunable Ojaswin Mujoo
  0 siblings, 2 replies; 16+ messages in thread
From: Ojaswin Mujoo @ 2025-02-22  8:40 UTC (permalink / raw)
  To: linux-ext4, Theodore Ts'o; +Cc: Jan Kara, linux-kernel

When running LTP stress tests on ext4, after a multiday run we seemed to
have hit the following BUG_ON:

 [NIP  : start_this_handle+268]
 #3 [c000001067c27a40] start_this_handle at c008000004d40f74 [jbd2]  (unreliable)
 #4 [c000001067c27b60] jbd2__journal_start at c008000004d415cc [jbd2]
 #5 [c000001067c27be0] update_super_work at c0080000053f9758 [ext4]
 #6 [c000001067c27c70] process_one_work at c000000000188790
 #7 [c000001067c27d20] worker_thread at c00000000018973c
 #8 [c000001067c27dc0] kthread at c000000000196c84
 #9 [c000001067c27e10] ret_from_kernel_thread at c00000000000cd64

Which comes out to

  382   repeat:
  383           read_lock(&journal->j_state_lock);
* 384           BUG_ON(journal->j_flags & JBD2_UNMOUNT);
  385           if (is_journal_aborted(journal) ||
  386               (journal->j_errno != 0 && !(journal->j_flags & JBD2_ACK_ERR))) {
  387                   read_unlock(&journal->j_state_lock);


Initially this seemed like it should never happen but upon crash
analysis it seems like it could indeed be hit as described in patch 1/2.

I would like to add that through the logs we only knew that:

- ext4_journal_bmap -> ext4_map_blocks is failing with EFSCORRUPTED.
- update_super_work had hit the BUG_ON

I was not able to hit this bug again (without modifying the kernel to
inject errors) but the above backtrace seems to be one possible paths
where this BUG_ON can be hit. Rest of the analysis and fix is in patch
1/2. Patch 2 is just a small tweak that i found helpful while debugging.

That being said, journalling is something I'm not very familiar with and
there might be gaps in my understanding so thoughts and suggestions are
welcome.

Ojaswin Mujoo (2):
  ext4: only defer sb update on error if SB_ACTIVE
  ext4: Make sb update interval tunable

 fs/ext4/ext4.h  |  9 +++++++++
 fs/ext4/super.c | 17 +++++++++--------
 fs/ext4/sysfs.c |  4 ++++
 3 files changed, 22 insertions(+), 8 deletions(-)

-- 
2.48.1


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

end of thread, other threads:[~2025-03-05  4:21 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-22  8:40 [PATCH 0/2] Fix a BUG_ON crashing the kernel in start_this_handle Ojaswin Mujoo
2025-02-22  8:40 ` [PATCH 1/2] ext4: only defer sb update on error if SB_ACTIVE Ojaswin Mujoo
2025-02-24 14:52   ` Jan Kara
2025-02-27 11:20     ` Ojaswin Mujoo
2025-03-04 10:25       ` Jan Kara
2025-03-04 12:54         ` Ojaswin Mujoo
2025-03-05  4:14         ` Ritesh Harjani
2025-02-25  1:53   ` Baokun Li
2025-02-25 12:06     ` Ojaswin Mujoo
2025-02-26  1:55       ` Baokun Li
2025-02-27 11:43         ` Ojaswin Mujoo
2025-02-27 12:51           ` Baokun Li
2025-03-03 17:30             ` Ojaswin Mujoo
2025-02-22  8:40 ` [PATCH 2/2] ext4: Make sb update interval tunable Ojaswin Mujoo
2025-02-22  9:32   ` Ritesh Harjani (IBM)
2025-02-24 14:27   ` Jan Kara

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