From: Brian Foster <bfoster@redhat.com>
To: Hongbo Li <lihongbo22@huawei.com>
Cc: kent.overstreet@linux.dev, linux-bcachefs@vger.kernel.org,
ruanjinjie@huawei.com, chris.zjh@huawei.com
Subject: Re: [PATCH] bcachefs: intercept mountoption value for bool type
Date: Wed, 21 Feb 2024 08:36:58 -0500 [thread overview]
Message-ID: <ZdX8ek1o6MQErZMr@bfoster> (raw)
In-Reply-To: <20240221093704.3924287-1-lihongbo22@huawei.com>
On Wed, Feb 21, 2024 at 05:37:04PM +0800, Hongbo Li wrote:
> 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;
It might be nice for that error message to be more specific in that the
bool value must be 0 or 1, but LGTM regardless:
Reviewed-by: Brian Foster <bfoster@redhat.com>
> }
> break;
> case BCH_OPT_UINT:
> --
> 2.34.1
>
next prev parent reply other threads:[~2024-02-21 13:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-21 9:37 [PATCH] bcachefs: intercept mountoption value for bool type Hongbo Li
2024-02-21 13:36 ` Brian Foster [this message]
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
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=ZdX8ek1o6MQErZMr@bfoster \
--to=bfoster@redhat.com \
--cc=chris.zjh@huawei.com \
--cc=kent.overstreet@linux.dev \
--cc=lihongbo22@huawei.com \
--cc=linux-bcachefs@vger.kernel.org \
--cc=ruanjinjie@huawei.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