Thread (6 messages) 6 messages, 3 authors, 13d ago

Re: [PATCH v2] ext4:Fix WARNING in ext4_journalled_invalidate_folio

From: Jan Kara <jack@suse.cz>
Date: 2026-09-14 18:47:37

On Tue 15-09-26 00:41:44, shuo chen wrote:
Thanks to Jack's suggestion.
Call the ext4_wait_for_tail_page_commit() helper before
ext4_truncate_failed_write() from ext4_journalled_write_end(),
which avoids invalidating the folio while it is being committed.

Suggested-by: Jan Kara <jack@suse.cz>
Reported-by: Farhad Alemi <redacted>
Closes:https://lore.kernel.org/linux-ext4/CA+0ovCgxFN3TLpdS_O_Z48sARuQ-WR-JLDCqQWEmd9ELtkzddA@mail.gmail.com/T/ (local)
Signed-off-by: shuo chen <redacted>
Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza
quoted hunk ↗ jump to hunk
---
 fs/ext4/inode.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index c2c2d6ac7f3d..10a89bbb994a 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -56,6 +56,7 @@ static void ext4_journalled_zero_new_buffers(handle_t *handle,
 					    struct inode *inode,
 					    struct folio *folio,
 					    unsigned from, unsigned to);
+static void ext4_wait_for_tail_page_commit(struct inode *inode);
 
 static __u32 ext4_inode_csum(struct inode *inode, struct ext4_inode *raw,
 			      struct ext4_inode_info *ei)
@@ -1605,6 +1606,7 @@ static int ext4_journalled_write_end(const struct kiocb *iocb,
 	if (!ret)
 		ret = ret2;
 	if (pos + len > inode->i_size && !verity) {
+		ext4_wait_for_tail_page_commit(inode);
 		ext4_truncate_failed_write(inode);
 		/*
 		 * If truncate failed early the inode might still be
-- 
2.55.0
-- 
Jan Kara [off-list ref]
SUSE Labs, CR
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help