Re: [PATCH v2] netfs: fix writeback ENOMEM by using __GFP_NOFAIL for rolling buffer
From: Zhou, Yun
Date: Mon Jul 27 2026 - 07:10:06 EST
On 7/27/26 18:03, David Howells wrote:
Yun Zhou <yun.zhou@xxxxxxxxxxxxx> wrote:
rolling_buffer_init() uses plain GFP_NOFS for its folio_queue allocation.
In the writeback path this can fail and trigger WARN_ON_ONCE(folio != NULL)
in netfs_writepages() when writeback_iter() returns additional dirty folios
left unhandled.
Writeback must not fail with -ENOMEM. Fix this by adding a gfp_t parameter
to rolling_buffer_init() and passing GFP_NOFS | __GFP_NOFAIL from the
writeback path, ensuring the allocation always succeeds. Read paths
continue to use plain GFP_NOFS.
I don't think this is the correct solution. I think you're right that a gfp_t
needs to be passed into rolling_buffer*(), but I think we need a mempool as
well.
I have most of the patch for that, but I think I need adjust things so that
the read path uses GFP_KERNEL, not GFP_NOFS.
Got it. Your mempool approach looks good. Please let me know if you need anything from me.
BR,
Yun