Linux EXT4 FS development
 help / color / mirror / Atom feed
From: zhangshida <starzhangzsd@gmail.com>
To: tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.com
Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
	zhangshida@kylinos.cn, starzhangzsd@gmail.com
Subject: [PATCH v4 0/2] Fix an error caused by improperly dirtied buffer
Date: Fri, 23 Aug 2024 09:33:27 +0800	[thread overview]
Message-ID: <20240823013329.1996741-1-zhangshida@kylinos.cn> (raw)

From: Shida Zhang <zhangshida@kylinos.cn>

Hi all,

On an old kernel version(4.19, ext3, data=journal, 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)


Changes since v3: 
- Ditch the patch 3 in v3, because some other code paths can set the 
  buffer dirty:
	ext4_write_begin
		ext4_block_write_begin
			create_empty_buffers
				set_buffer_dirty 

[3] Version 3:
https://lore.kernel.org/linux-ext4/20240810082814.3709867-1-zhangshida@kylinos.cn/
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-2-zhangshida@kylinos.cn/
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/20240720062356.2522658-1-zhangshida@kylinos.cn/




Shida Zhang (2):
  ext4: hoist ext4_block_write_begin and replace the __block_write_begin
  ext4: fix a potential assertion failure due to improperly dirtied
    buffer

 fs/ext4/ext4.h   |  3 +++
 fs/ext4/inline.c | 11 ++++++-----
 fs/ext4/inode.c  | 51 +++++++++++++++++++++++++-----------------------
 3 files changed, 36 insertions(+), 29 deletions(-)

-- 
2.33.0


             reply	other threads:[~2024-08-23  1:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-23  1:33 zhangshida [this message]
2024-08-23  1:33 ` [PATCH 1/2] ext4: hoist ext4_block_write_begin and replace the __block_write_begin zhangshida
2024-08-28 11:04   ` Jan Kara
2024-08-29  0:03   ` Eric Biggers
2024-08-29  1:28     ` Stephen Zhang
2024-08-23  1:33 ` [PATCH 2/2] ext4: fix a potential assertion failure due to improperly dirtied buffer zhangshida
2024-08-28 11:45   ` Jan Kara
2024-08-29  1:50     ` Stephen Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240823013329.1996741-1-zhangshida@kylinos.cn \
    --to=starzhangzsd@gmail.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=zhangshida@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox