* [PATCH] fuse: replace BUG_ON with WARN_ON and -EBUSY in fuse_ctl_fill_super
@ 2026-02-24 11:56 Yuto Ohnuki
2026-03-02 15:43 ` Miklos Szeredi
0 siblings, 1 reply; 2+ messages in thread
From: Yuto Ohnuki @ 2026-02-24 11:56 UTC (permalink / raw)
To: Miklos Szeredi; +Cc: linux-fsdevel, linux-kernel, Yuto Ohnuki
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fuse: replace BUG_ON with WARN_ON and -EBUSY in fuse_ctl_fill_super
2026-02-24 11:56 [PATCH] fuse: replace BUG_ON with WARN_ON and -EBUSY in fuse_ctl_fill_super Yuto Ohnuki
@ 2026-03-02 15:43 ` Miklos Szeredi
0 siblings, 0 replies; 2+ messages in thread
From: Miklos Szeredi @ 2026-03-02 15:43 UTC (permalink / raw)
To: Yuto Ohnuki; +Cc: linux-fsdevel, linux-kernel
On Tue, 24 Feb 2026 at 12:56, Yuto Ohnuki <ytohnuki@amazon.com> wrote:
>
> 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.
NAK, I don't want to add complexity where it has zero benefit.
Thanks,
Miklos
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-02 15:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-24 11:56 [PATCH] fuse: replace BUG_ON with WARN_ON and -EBUSY in fuse_ctl_fill_super Yuto Ohnuki
2026-03-02 15:43 ` Miklos Szeredi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox