public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [syzbot] [mm?] WARNING in ext4_mb_load_buddy_gfp
       [not found] <CADhLXY4XxHAF95Nq2NSg5kkDWWdEmonYaGM_6a0CfdfedHAF9A@mail.gmail.com>
@ 2025-09-19  1:27 ` syzbot
  0 siblings, 0 replies; 3+ messages in thread
From: syzbot @ 2025-09-19  1:27 UTC (permalink / raw)
  To: kartikey406, linux-ext4, linux-kernel, syzkaller-bugs

Hello,

syzbot tried to test the proposed patch but the build/boot failed:

failed to apply patch:
checking file fs/ext4/mballoc.c
patch: **** unexpected end of file in patch



Tested on:

commit:         097a6c33 Merge tag 'trace-rv-v6.17-rc5' of git://git.k..
git tree:       upstream
kernel config:  https://syzkaller.appspot.com/x/.config?x=bf99f2510ef92ba5
dashboard link: https://syzkaller.appspot.com/bug?extid=fd3f70a4509fca8c265d
compiler:       
patch:          https://syzkaller.appspot.com/x/patch.diff?x=128d3f62580000


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] ext4: fix allocation failure in ext4_mb_load_buddy_gfp
@ 2025-09-19  1:32 Deepanshu Kartikey
  2025-09-19  1:53 ` [syzbot] [mm?] WARNING " syzbot
  0 siblings, 1 reply; 3+ messages in thread
From: Deepanshu Kartikey @ 2025-09-19  1:32 UTC (permalink / raw)
  To: syzbot+fd3f70a4509fca8c265d
  Cc: syzkaller-bugs, linux-ext4, Deepanshu Kartikey

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

Fix WARNING in __alloc_pages_slowpath() when ext4_discard_preallocations()
is called during memory pressure.

The issue occurs when __GFP_NOFAIL is used during memory reclaim context,
which can lead to allocation warnings. Avoid using __GFP_NOFAIL when
the current process is already in memory allocation context to prevent
potential deadlocks and warnings.

Reported-by: syzbot+fd3f70a4509fca8c265d@syzkaller.appspotmail.com
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
---
 fs/ext4/mballoc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 5898d92ba19f..61ee009717f1 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -5656,9 +5656,11 @@ void ext4_discard_preallocations(struct inode *inode)
 	list_for_each_entry_safe(pa, tmp, &list, u.pa_tmp_list) {
 		BUG_ON(pa->pa_type != MB_INODE_PA);
 		group = ext4_get_group_number(sb, pa->pa_pstart);
+		gfp_t flags = GFP_NOFS;
+		if (!(current->flags & PF_MEMALLOC))
+			flags |= __GFP_NOFAIL;
 
-		err = ext4_mb_load_buddy_gfp(sb, group, &e4b,
-					     GFP_NOFS|__GFP_NOFAIL);
+		err = ext4_mb_load_buddy_gfp(sb, group, &e4b, flags);
 		if (err) {
 			ext4_error_err(sb, -err, "Error %d loading buddy information for %u",
 				       err, group);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [syzbot] [mm?] WARNING in ext4_mb_load_buddy_gfp
  2025-09-19  1:32 [PATCH] ext4: fix allocation failure in ext4_mb_load_buddy_gfp Deepanshu Kartikey
@ 2025-09-19  1:53 ` syzbot
  0 siblings, 0 replies; 3+ messages in thread
From: syzbot @ 2025-09-19  1:53 UTC (permalink / raw)
  To: kartikey406, linux-ext4, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+fd3f70a4509fca8c265d@syzkaller.appspotmail.com
Tested-by: syzbot+fd3f70a4509fca8c265d@syzkaller.appspotmail.com

Tested on:

commit:         097a6c33 Merge tag 'trace-rv-v6.17-rc5' of git://git.k..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16e4c712580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=bf99f2510ef92ba5
dashboard link: https://syzkaller.appspot.com/bug?extid=fd3f70a4509fca8c265d
compiler:       Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
patch:          https://syzkaller.appspot.com/x/patch.diff?x=142f1c7c580000

Note: testing is done by a robot and is best-effort only.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-09-19  1:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-19  1:32 [PATCH] ext4: fix allocation failure in ext4_mb_load_buddy_gfp Deepanshu Kartikey
2025-09-19  1:53 ` [syzbot] [mm?] WARNING " syzbot
     [not found] <CADhLXY4XxHAF95Nq2NSg5kkDWWdEmonYaGM_6a0CfdfedHAF9A@mail.gmail.com>
2025-09-19  1:27 ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox