From: Yuto Ohnuki <ytohnuki@amazon.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: <linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
"Yuto Ohnuki" <ytohnuki@amazon.com>
Subject: [PATCH] fuse: replace BUG_ON with WARN_ON and -EBUSY in fuse_ctl_fill_super
Date: Tue, 24 Feb 2026 11:56:07 +0000 [thread overview]
Message-ID: <20260224115606.4249-2-ytohnuki@amazon.com> (raw)
Replace BUG_ON(fuse_control_sb) with WARN_ON() that returns -EBUSY.
Currently get_tree_single() prevents duplicate calls to
fuse_ctl_fill_super(), making this condition unreachable in practice.
However, BUG_ON() should not be used for conditions that can be handled
gracefully. Use WARN_ON() to log the unexpected state instead of
crashing.
Signed-off-by: Yuto Ohnuki <ytohnuki@amazon.com>
---
fs/fuse/control.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index 140bd5730d99..8bac837fd4e1 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -316,7 +316,11 @@ static int fuse_ctl_fill_super(struct super_block *sb, struct fs_context *fsc)
return err;
mutex_lock(&fuse_mutex);
- BUG_ON(fuse_control_sb);
+ if (WARN_ON(fuse_control_sb)) {
+ mutex_unlock(&fuse_mutex);
+ return -EBUSY;
+ }
+
fuse_control_sb = sb;
list_for_each_entry(fc, &fuse_conn_list, entry) {
err = fuse_ctl_add_conn(fc);
--
2.50.1
Amazon Web Services EMEA SARL, 38 avenue John F. Kennedy, L-1855 Luxembourg, R.C.S. Luxembourg B186284
Amazon Web Services EMEA SARL, Irish Branch, One Burlington Plaza, Burlington Road, Dublin 4, Ireland, branch registration number 908705
next reply other threads:[~2026-02-24 11:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-24 11:56 Yuto Ohnuki [this message]
2026-03-02 15:43 ` [PATCH] fuse: replace BUG_ON with WARN_ON and -EBUSY in fuse_ctl_fill_super Miklos Szeredi
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=20260224115606.4249-2-ytohnuki@amazon.com \
--to=ytohnuki@amazon.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/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