public inbox for linux-bcachefs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Disseldorp <ddiss@suse.de>
To: Hongbo Li <lihongbo22@huawei.com>
Cc: <kent.overstreet@linux.dev>, <linux-bcachefs@vger.kernel.org>,
	<liaochang1@huawei.com>
Subject: Re: [PATCH] bcachefs: fix incorrect show_options results
Date: Mon, 23 Sep 2024 14:39:31 +0000	[thread overview]
Message-ID: <20240923143931.3a24e3c9.ddiss@suse.de> (raw)
In-Reply-To: <20240923095003.3559171-1-lihongbo22@huawei.com>

On Mon, 23 Sep 2024 17:50:03 +0800, Hongbo Li wrote:

> When call show_options in bcachefs, the options buffer is appeneded
> to the seq variable. In fact, it requires an additional comma to be
> appended first. This will affect the remount process when reading
> existing mount options.
> 
> Fixes: 9305cf91d05e ("bcachefs: bch2_opts_to_text()")

Ah, that'd explain why I wasn't seeing this alongside the
fail-on-unknown-opt fix. FWIW, this first appears in
bcachefs-2024-09-21 as 3621ecc10f831f4fd27784083dfaf5b8481098b5 .

> Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
> ---
>  fs/bcachefs/fs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
> index e774cb3e6b1a..79c3a650b714 100644
> --- a/fs/bcachefs/fs.c
> +++ b/fs/bcachefs/fs.c
> @@ -1927,7 +1927,7 @@ static int bch2_show_options(struct seq_file *seq, struct dentry *root)
>  	bch2_opts_to_text(&buf, c->opts, c, c->disk_sb.sb,
>  			  OPT_MOUNT, OPT_HIDDEN, OPT_SHOW_MOUNT_STYLE);
>  	printbuf_nul_terminate(&buf);
> -	seq_puts(seq, buf.buf);
> +	seq_printf(seq, ",%s", buf.buf);

Looks okay, although it might be simpler to just drop the !first
conditionals from bch2_opts_to_text() as things were prior to the
regression.

>  	int ret = buf.allocation_failure ? -ENOMEM : 0;

Should the copy from buf into seq occur if allocation_failure
is already flagged? I'd expect seq_puts() to have oopsed.

  reply	other threads:[~2024-09-23 14:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-23  9:50 [PATCH] bcachefs: fix incorrect show_options results Hongbo Li
2024-09-23 14:39 ` David Disseldorp [this message]
2024-09-23 21:40   ` Kent Overstreet
2024-09-24  2:52     ` David Disseldorp
2024-09-24  1:29   ` 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=20240923143931.3a24e3c9.ddiss@suse.de \
    --to=ddiss@suse.de \
    --cc=kent.overstreet@linux.dev \
    --cc=liaochang1@huawei.com \
    --cc=lihongbo22@huawei.com \
    --cc=linux-bcachefs@vger.kernel.org \
    /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