From: Boris Burkov <boris@bur.io>
To: Qu Wenruo <wqu@suse.com>
Cc: David Sterba <dsterba@suse.cz>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs-progs: subvolume: output the prompt line only when the ioctl succeeded
Date: Tue, 26 Mar 2024 13:33:55 -0700 [thread overview]
Message-ID: <20240326203355.GA2197422@zen.localdomain> (raw)
In-Reply-To: <bafb239d-5c78-451d-b981-8d79aa3c1200@suse.com>
On Wed, Mar 27, 2024 at 06:57:48AM +1030, Qu Wenruo wrote:
>
>
> 在 2024/3/27 06:53, Boris Burkov 写道:
> > On Fri, Mar 01, 2024 at 01:56:31PM +0100, David Sterba wrote:
> > > On Tue, Feb 27, 2024 at 02:41:16PM +1030, Qu Wenruo wrote:
> > > > [BUG]
> > > > With the latest kernel patch to reject invalid qgroupids in
> > > > btrfs_qgroup_inherit structure, "btrfs subvolume create" or "btrfs
> > > > subvolume snapshot" can lead to the following output:
> > > >
> > > > # mkfs.btrfs -O quota -f $dev
> > > > # mount $dev $mnt
> > > > # btrfs subvolume create -i 2/0 $mnt/subv1
> > > > Create subvolume '/mnt/btrfs/subv1'
> > > > ERROR: cannot create subvolume: No such file or directory
> > > >
> > > > The "btrfs subvolume" command output the first line, seemingly to
> > > > indicate a successful subvolume creation, then followed by an error
> > > > message.
> > > >
> > > > This can be a little confusing on whether if the subvolume is created or
> > > > not.
> > > >
> > > > [FIX]
> > > > Fix the output by only outputting the regular line if the ioctl
> > > > succeeded.
> > > >
> > > > Signed-off-by: Qu Wenruo <wqu@suse.com>
> > >
> > > Added to devel, thanks.
> >
> > This patch breaks every test that creates snapshots or subvolumes and
> > expects the output in the outfile.
> >
> > That's because it did:
> > s/Create a snapshot/Create snapshot/
> >
> > Please run the tests when making changes! This failed on btrfs/001, so
> > it would have taken 1 second to see.
>
> Wrong patch to blame?
>
> The message is kept the same in the patch:
>
> - pr_verbose(LOG_DEFAULT,
> - "Create a readonly snapshot of '%s' in '%s/%s'\n",
> - subvol, dstdir, newname);
> - pr_verbose(LOG_DEFAULT,
> - "Create a snapshot of '%s' in '%s/%s'\n",
> - subvol, dstdir, newname);
>
> + pr_verbose(LOG_DEFAULT,
> + "Create a readonly snapshot of '%s' in '%s/%s'\n",
> + subvol, dstdir, newname);
> + pr_verbose(LOG_DEFAULT,
> + "Create a snapshot of '%s' in '%s/%s'\n",
> + subvol, dstdir, newname);
>
> Thanks,
> Qu
Hmm, something weird happened. I'm looking at commit
5f87b467a9e7 ("btrfs-progs: subvolume: output the prompt line only when the ioctl succeeded")
in the master branch of https://github.com/kdave/btrfs-progs.git
and it has the (relevant) diff:
- if (readonly) {
+ if (readonly)
args.flags |= BTRFS_SUBVOL_RDONLY;
- pr_verbose(LOG_DEFAULT,
- "Create a readonly snapshot of '%s' in '%s/%s'\n",
- subvol, dstdir, newname);
- } else {
- pr_verbose(LOG_DEFAULT,
- "Create a snapshot of '%s' in '%s/%s'\n",
- subvol, dstdir, newname);
- }
args.fd = fd;
if (inherit) {
@@ -784,6 +776,15 @@ static int cmd_subvolume_snapshot(const struct cmd_struct *cmd, int argc, char *
retval = 0; /* success */
+ if (readonly)
+ pr_verbose(LOG_DEFAULT,
+ "Create readonly snapshot of '%s' in '%s/%s'\n",
+ subvol, dstdir, newname);
+ else
+ pr_verbose(LOG_DEFAULT,
+ "Create snapshot of '%s' in '%s/%s'\n",
+ subvol, dstdir, newname);
+
prev parent reply other threads:[~2024-03-26 20:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-27 4:11 [PATCH] btrfs-progs: subvolume: output the prompt line only when the ioctl succeeded Qu Wenruo
2024-02-27 4:59 ` HAN Yuwei
2024-02-27 5:31 ` Qu Wenruo
2024-03-01 12:56 ` David Sterba
2024-03-26 20:23 ` Boris Burkov
2024-03-26 20:27 ` Qu Wenruo
2024-03-26 20:30 ` Qu Wenruo
2024-03-26 20:34 ` Boris Burkov
2024-03-26 22:44 ` David Sterba
2024-03-26 20:33 ` Boris Burkov [this message]
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=20240326203355.GA2197422@zen.localdomain \
--to=boris@bur.io \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.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