* [PATCH] ext4: defend against inline-to-block conversion race in write completion
@ 2026-07-18 6:12 Deepanshu Kartikey
2026-07-23 12:52 ` Theodore Tso
0 siblings, 1 reply; 2+ messages in thread
From: Deepanshu Kartikey @ 2026-07-18 6:12 UTC (permalink / raw)
To: tytso, adilger.kernel, libaokun, jack, ojaswin, ritesh.list,
yi.zhang
Cc: linux-ext4, linux-kernel, Deepanshu Kartikey,
syzbot+293a57918b36cfae3d48
Replace BUG_ON(!ext4_has_inline_data(inode)) with defensive error handling
in ext4_write_inline_data_end(). A file can be converted from inline to block
storage by concurrent paths while a write completion is in flight.
Lock-based synchronization is impractical here since multiple conversion paths
use different locks. Defensive check with proper cleanup
handles all races uniformly and safely.
Reported-by: syzbot+293a57918b36cfae3d48@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=293a57918b36cfae3d48
Tested-by: syzbot+293a57918b36cfae3d48@syzkaller.appspotmail.com
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
---
fs/ext4/inline.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index 8045e4ff270c..53d783235da9 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -812,7 +812,14 @@ int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len,
goto out;
}
ext4_write_lock_xattr(inode, &no_expand);
- BUG_ON(!ext4_has_inline_data(inode));
+ /* File may have been converted to block storage by concurrent path */
+ if (!ext4_has_inline_data(inode)) {
+ ext4_write_unlock_xattr(inode, &no_expand);
+ brelse(iloc.bh);
+ folio_unlock(folio);
+ folio_put(folio);
+ return -EIO;
+ }
/*
* ei->i_inline_off may have changed since
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ext4: defend against inline-to-block conversion race in write completion
2026-07-18 6:12 [PATCH] ext4: defend against inline-to-block conversion race in write completion Deepanshu Kartikey
@ 2026-07-23 12:52 ` Theodore Tso
0 siblings, 0 replies; 2+ messages in thread
From: Theodore Tso @ 2026-07-23 12:52 UTC (permalink / raw)
To: Deepanshu Kartikey
Cc: adilger.kernel, libaokun, jack, ojaswin, ritesh.list, yi.zhang,
linux-ext4, linux-kernel, syzbot+293a57918b36cfae3d48
On Sat, Jul 18, 2026 at 11:42:38AM -0500, Deepanshu Kartikey wrote:
> Replace BUG_ON(!ext4_has_inline_data(inode)) with defensive error handling
> in ext4_write_inline_data_end(). A file can be converted from inline to block
> storage by concurrent paths while a write completion is in flight.
Thanks for this proposed change. It's covered, as part of Aditya
Prakash Srivastava change, "ext4: use fsdata to track inline data
write state and fix race"[1] which is being tested in my tree.
[1] https://patch.msgid.link/20260703045414.1768-1-aditya.ansh182@gmail.com
- Ted
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-23 12:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-18 6:12 [PATCH] ext4: defend against inline-to-block conversion race in write completion Deepanshu Kartikey
2026-07-23 12:52 ` Theodore Tso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox