[PATCH v2 0/2] ceph: GFP_NOFS fix for cap flush writeback recursion

Xiubo Li via B4 Relay <[email protected]>
Newsgroups org.kernel.vger.ceph-devel,org.kernel.feeds.b4-sent,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
These two patches fix GFP flag issues in the filesystem I/O paths
discovered while reviewing Max Kellermann's "ceph: avoid fs reclaim
while using current->journal_info" fix.

The first patch is a real fix: ceph_alloc_cap_flush() is called from
ceph_writepages_start() inside the writeback layer, but uses GFP_KERNEL.
Direct reclaim triggered by this allocation can re-enter the writeback
path via the shrinker, causing recursive writeback and potential stack
overflow.  Fix it to use GFP_NOFS, consistent with other allocations in
the same writepages path.

The second patch is a cleanup: __ceph_pool_perm_get() had five
allocations using GFP_NOFS and one using GFP_KERNEL, despite the
function only being called from user I/O paths where GFP_NOFS is
unnecessary.  Use GFP_KERNEL consistently.

---
Changes in v2:
- Convert the last two GFP_NOFS allocations (rd_req and perm) to GFP_KERNEL, covering all six call sites.
- Correct commit message count: s/four/six/.
- Link to v1: https://patch.msgid.link/[email protected]

---
Xiubo Li (2):
      ceph: use GFP_NOFS for cap flush allocation in writeback path
      ceph: use GFP_KERNEL consistently in __ceph_pool_perm_get()

 fs/ceph/addr.c | 10 +++++-----
 fs/ceph/caps.c |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
---
base-commit: 0b79edbeed72d6c75987b5b402edeafceb4d080d
change-id: 20260723-b4-gfp_nofs-ea6d112a2570

Best regards,
--  
Xiubo Li <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.