public inbox for linux-bcachefs@vger.kernel.org
 help / color / mirror / Atom feed
From: Alan Huang <mmpgouride@gmail.com>
To: kent.overstreet@linux.dev
Cc: linux-bcachefs@vger.kernel.org, Alan Huang <mmpgouride@gmail.com>,
	syzbot+fe63f377148a6371a9db@syzkaller.appspotmail.com
Subject: [PATCH] bcachefs: Use alloc_percpu_gfp to avoid deadlock
Date: Wed, 12 Feb 2025 18:06:25 +0800	[thread overview]
Message-ID: <20250212100625.55860-1-mmpgouride@gmail.com> (raw)

The cycle:

CPU0:			CPU1:
bc->lock		pcpu_alloc_mutex
pcpu_alloc_mutex	bc->lock

Reported-by: syzbot+fe63f377148a6371a9db@syzkaller.appspotmail.com
Tested-by: syzbot+fe63f377148a6371a9db@syzkaller.appspotmail.com
Signed-off-by: Alan Huang <mmpgouride@gmail.com>
---
 fs/bcachefs/six.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/bcachefs/six.c b/fs/bcachefs/six.c
index 7e7c66a1e1a6..ccdc6d496910 100644
--- a/fs/bcachefs/six.c
+++ b/fs/bcachefs/six.c
@@ -873,7 +873,7 @@ void __six_lock_init(struct six_lock *lock, const char *name,
 		 * failure if they wish by checking lock->readers, but generally
 		 * will not want to treat it as an error.
 		 */
-		lock->readers = alloc_percpu(unsigned);
+		lock->readers = alloc_percpu_gfp(unsigned, GFP_NOWAIT|__GFP_NOWARN);
 	}
 #endif
 }
-- 
2.47.0


             reply	other threads:[~2025-02-12 10:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-12 10:06 Alan Huang [this message]
2025-02-12 14:27 ` [PATCH] bcachefs: Use alloc_percpu_gfp to avoid deadlock Kent Overstreet
2025-02-20 10:57   ` Alan Huang
2025-02-20 12:40     ` Kent Overstreet
2025-02-20 12:44       ` Alan Huang
2025-02-20 17:16     ` Vlastimil Babka
2025-02-20 20:37       ` Kent Overstreet
2025-02-21  2:46         ` Dennis Zhou
2025-02-21  7:21           ` Vlastimil Babka
2025-02-21 19:44           ` Alan Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250212100625.55860-1-mmpgouride@gmail.com \
    --to=mmpgouride@gmail.com \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-bcachefs@vger.kernel.org \
    --cc=syzbot+fe63f377148a6371a9db@syzkaller.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox