public inbox for linux-bcachefs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bcachefs: intercept mountoption value for bool type
@ 2024-02-21  9:37 Hongbo Li
  2024-02-21 13:36 ` Brian Foster
  0 siblings, 1 reply; 6+ messages in thread
From: Hongbo Li @ 2024-02-21  9:37 UTC (permalink / raw)
  To: kent.overstreet, bfoster
  Cc: linux-bcachefs, ruanjinjie, lihongbo22, chris.zjh

For mount option with bool type, the value must be 0 or 1 (See
bch2_opt_parse). But this seems does not well intercepted cause
for other value(like 2...), it returns the unexpect return code
with error message printed.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
---
 fs/bcachefs/opts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/bcachefs/opts.c b/fs/bcachefs/opts.c
index b1ed0b9a20d3..fe1f17830694 100644
--- a/fs/bcachefs/opts.c
+++ b/fs/bcachefs/opts.c
@@ -314,7 +314,7 @@ int bch2_opt_parse(struct bch_fs *c,
 		if (ret < 0 || (*res != 0 && *res != 1)) {
 			if (err)
 				prt_printf(err, "%s: must be bool", opt->attr.name);
-			return ret;
+			return ret < 0 ?: -EINVAL;
 		}
 		break;
 	case BCH_OPT_UINT:
-- 
2.34.1


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

end of thread, other threads:[~2024-02-22  3:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-21  9:37 [PATCH] bcachefs: intercept mountoption value for bool type Hongbo Li
2024-02-21 13:36 ` Brian Foster
2024-02-21 23:51   ` Kent Overstreet
2024-02-22  1:30     ` Hongbo Li
2024-02-22  3:03       ` Kent Overstreet
2024-02-22  3:46         ` Hongbo Li

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