mbox series

[v3,0/3] Fix an error caused by improperly dirtied buffer

Message ID 20240810082814.3709867-1-zhangshida@kylinos.cn
Headers show
Series Fix an error caused by improperly dirtied buffer | expand

Message

zhangshida Aug. 10, 2024, 8:28 a.m. UTC
From: Shida Zhang <zhangshida@kylinos.cn>

Hi all,

On an old kernel version(4.19, ext3, journal=data, pagesize=64k),
an assertion failure will occasionally be triggered by the line below:
---------
jbd2_journal_commit_transaction
{
...
J_ASSERT_BH(bh, !buffer_dirty(bh));
/*
* The buffer on BJ_Forget list and not jbddirty means
...
}
---------

The same condition may also be applied to the lattest kernel version.

This patch set fixes it by:
1.Replace the __block_write_begin with the hoisted
  ext4_block_write_begin().(patch 1)
2.Trace the user data dirtying in ext4_block_write_begin().(patch 2)
3.Remove some superfluous things.(patch 3)

Changes since v2:
- Adjust the applied order of patch 1 and patch 2 in v1.
- Reword the commit message.
- Remove some superfluous logic in patch 2 and patch 3.

[2] Version 2:
https://lore.kernel.org/linux-ext4/20240809064606.3490994-1-zhangshida@kylinos.cn/T/#m5da94f8299ef9e491e03f4d0cd19581ef5f13288
Changes since v1:
- v1 use a hack into jbd2 to fix the bug while v2 choose to journal
  the dirty data in *_block_write_begin.

[1] Version 1:
https://lore.kernel.org/linux-ext4/CANubcdVHbbq=WsTXU4EWAUPUby5--CLe5rf1GPzNPv+Y0a9VzQ@mail.gmail.com/T/#m19d3b9357f5dff050f75edc863e47f3cb018d778

Shida Zhang (3):
  ext4: hoist ext4_block_write_begin and replace the __block_write_begin
  ext4: fix a potential assertion failure due to improperly dirtied
    buffer
  ext4: remove the superfluous things left by __block_write_begin

 fs/ext4/ext4.h   |  3 ++
 fs/ext4/inline.c | 11 ++++----
 fs/ext4/inode.c  | 71 ++++++++++++++++++++----------------------------
 3 files changed, 39 insertions(+), 46 deletions(-)