Re: [PATCH 1/2] ocfs2: cluster: use GFP_NOFS for heartbeat bio allocation
Andrew Morton <[email protected]> Fri, 10 Jul 2026 17:26:29 -0700
| Newsgroups | dev.linux.lists.ocfs2-devel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 10 Jul 2026 15:17:55 +0800 Joseph Qi <[email protected]> wrote: > o2hb_setup_one_bio() allocates the heartbeat bio with GFP_ATOMIC. The > disk heartbeat runs in the o2hb kernel thread (o2hb_do_disk_heartbeat), > which is process context and can sleep, so there is no atomicity > requirement here. > > GFP_ATOMIC lacks __GFP_DIRECT_RECLAIM, so the allocation is not served > from the fs_bio_set mempool reserve and can return NULL under memory > pressure. A failed heartbeat allocation aborts the heartbeat and can > lead to the local node being fenced, which is exactly what the old > comment worried about. > > Use GFP_NOFS instead. It keeps __GFP_DIRECT_RECLAIM so the allocation is > backed by the fs_bio_set mempool and cannot fail, while avoiding > recursion back into the filesystem during heartbeat I/O. As the > allocation can no longer fail, drop the dead ERR_PTR(-ENOMEM) path in > o2hb_setup_one_bio() and the now-redundant IS_ERR() handling in its > callers. fyi, AI review asked a thing: https://sashiko.dev/#/patchset/[email protected]