Skip to contentSkip to conversation

xfs: don't use __GFP_NOFAIL in xfs_init_fs_context

PATCH Applied Christoph Hellwig 2 participants 2 messages Oct 3, 2025 – Oct 21, 2025 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xfs: don't use __GFP_NOFAIL in xfs_init_fs_context

With enough debug options enabled, struct xfs_mount is larger than 4k and thus NOFAIL allocations won't work for it.

xfs_init_fs_context is early in the mount process, and if we really are out of memory there we'd better give up ASAP anyway.

Fixes 7b77b46a6137 ("xfs: use kmem functions for struct xfs_mount")
Reported-by [email protected]

---

Changes since v1:
- update commit log for the proper root cause, add Fixes and Reported-by tags.

 fs/xfs/xfs_super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_super.c +1 -1
index e85a156dc17d..8aa562a8b60b 100644
@@ -2221,7 +2221,7 @@ xfs_init_fs_context(
 	struct xfs_mount	*mp;
 	int			i;
 
-	mp = kzalloc(sizeof(struct xfs_mount), GFP_KERNEL | __GFP_NOFAIL);
+	mp = kzalloc(sizeof(struct xfs_mount), GFP_KERNEL);
 	if (!mp)
 		return -ENOMEM;
 
Signature · 1 line
2.47.3
maintainer Applied
#1 lore raw
Quoted 8 lines · Christoph Hellwig

With enough debug options enabled, struct xfs_mount is larger than 4k and thus NOFAIL allocations won't work for it.

xfs_init_fs_context is early in the mount process, and if we really are out of memory there we'd better give up ASAP anyway.

[...]

Applied to for-next, thanks!

[1/1] xfs: don't use __GFP_NOFAIL in xfs_init_fs_context

      commit: 0f41997b1b2b769b73415512d2afaae80630e4fe

Best regards,

Signature · 1 line
Carlos Maiolino <[email protected]>