Re: [PATCH] netfs: fix ENOMEM handling in netfs_writepages() to drain all dirty folios
"Zhou, Yun" <[email protected]> Thu, 23 Jul 2026 15:25:05 +0800
| Newsgroups | dev.linux.lists.netfs,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On 7/23/26 12:59, Christoph Hellwig wrote: > On Tue, Jul 07, 2026 at 01:25:55PM +0800, Yun Zhou wrote: >> When netfs_create_write_req() fails with -ENOMEM in netfs_writepages(), >> the couldnt_start error path redirties and unlocks the first folio, > > writeback must use mempools to back resoures, or __GFP_NOFAIL if it > can't for some reason. -ENOMEM must not happend in writeback paths > or your toast. So please fix the cause of this error and not the > symptoms. > Thanks for the review. You're right - writeback should not fail with ENOMEM. I'll follow your suggestion and use __GFP_NOFAIL for the allocation in the writeback path. The ENOMEM here comes from rolling_buffer_init() which uses plain GFP_NOFS for its folio_queue allocation. Using mempools would be the more robust approach, but it requires adding a new mempool, modifying the rolling_buffer_init() signature and all its callers, plus the init/destroy lifecycle - a much larger change. __GFP_NOFAIL is a minimal fix that achieves the same goal for the writeback path. Will send v2 shortly.