Skip to content

Commit 2a68d61

Browse files
Hongbo LiKent Overstreet
authored andcommitted
bcachefs: intercept mountoption value for bool type
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 <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
1 parent 7e23c17 commit 2a68d61

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

fs/bcachefs/errcode.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
x(EINVAL, mount_option) \
99
x(BCH_ERR_mount_option, option_name) \
1010
x(BCH_ERR_mount_option, option_value) \
11+
x(BCH_ERR_mount_option, option_not_bool) \
1112
x(ENOMEM, ENOMEM_stripe_buf) \
1213
x(ENOMEM, ENOMEM_replicas_table) \
1314
x(ENOMEM, ENOMEM_cpu_replicas) \

fs/bcachefs/opts.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ int bch2_opt_parse(struct bch_fs *c,
314314
if (ret < 0 || (*res != 0 && *res != 1)) {
315315
if (err)
316316
prt_printf(err, "%s: must be bool", opt->attr.name);
317-
return ret;
317+
return ret < 0 ? ret : -BCH_ERR_option_not_bool;
318318
}
319319
break;
320320
case BCH_OPT_UINT:

0 commit comments

Comments
 (0)