Commit e2c4c49dee64 ("ext4: restart handle if credits are insufficient during allocating blocks") made ext4_block_write_begin() return -EAGAIN when it cannot extend the handle, and taught its callers in inode.c to retry. ext4_convert_inline_data_to_extent() was missed and passes the error to write(2). It always needs the extension, because its handle is sized before the inode has an extent tree, so with nodelalloc a write that converts inline data fails with EAGAIN when a commit starts. Retry on -EAGAIN like the other callers. Reported-by: Sashiko Link: https://lore.kernel.org/linux-ext4/sashiko-outbox-236164@kernel.org/ Fixes: e2c4c49dee64 ("ext4: restart handle if credits are insufficient during allocating blocks") Cc: stable@vger.kernel.org --- Found while checking a review comment on "ext4: convert regular file inline data through the page cache", which has the same gap. Reproduced in QEMU (x86_64, 4 CPUs) on a 1k-block filesystem with a 1 MiB journal, mounted with nodelalloc: 8 threads create a file, write 42 bytes and then 300 bytes at offset 100, while another thread loops on sync(). In each of three 20-second runs, write() failed with EAGAIN about 300 times on e2c4c49dee64 and never on its parent. With this patch it never failed, and every file read back intact. The ext4 KUnit suite passes. After a failed attempt the error path has already dropped the inline data, so the retry continues from the data in folio 0, as the existing ENOSPC retry does. This patch was developed with the help of an AI coding assistant (Claude Opus via OpenCode). It analysed the bug, wrote the fix, the changelog and the reproducer; I reviewed the change and the test results. fs/ext4/inline.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index acdc65ce4796..274cc96daec7 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -682,7 +682,8 @@ static int ext4_convert_inline_data_to_extent(struct address_space *mapping, ext4_orphan_del(NULL, inode); } - if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) + if (ret == -EAGAIN || + (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))) goto retry; if (folio) -- 2.56.1