From fcbfdc0a883f2c072a7045303d0a15a67d7d4c52 Mon Sep 17 00:00:00 2001 From: Chris Kirby Date: Tue, 6 Oct 2026 14:06:03 -0500 Subject: [PATCH] Handle ENOBUFS from the extent allocator in the write paths We can get ENOBUFS when trying to allocate an extent if we've exhausted our local supply of extents. Rather than returning this error all the way back to user space, do what the pre-iomap write paths did and drop our inode lock, release the transaction, and retry. This gives the allocator an opportunity to refresh its extent pool. Signed-off-by: Chris Kirby --- kmod/src/file.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kmod/src/file.c b/kmod/src/file.c index ca4a16ef..7d8410e7 100644 --- a/kmod/src/file.c +++ b/kmod/src/file.c @@ -368,8 +368,12 @@ retry: out: if (locked) { unlock_for_iomap_write(inode, scoutfs_inode_lock, &ind_locks, written); + locked = false; } + if (ret == -ENOBUFS) + goto retry; + return ret < 0 ? ret : written; } @@ -435,8 +439,12 @@ retry: out: if (locked) { unlock_for_iomap_write(inode, scoutfs_inode_lock, &ind_locks, written); + locked = false; } + if (ret == -ENOBUFS) + goto retry; + if (written > 0 && ((orig_pos + written) & BACKGROUND_WRITEBACK_MASK) == 0) { scoutfs_writepages_sync_none(file->f_mapping, orig_pos + written - BACKGROUND_WRITEBACK_BYTES,