From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: qgroup: do not check qgroup inherit if qgroup is disabled
Date: Tue, 23 Apr 2024 15:46:47 +0200 [thread overview]
Message-ID: <20240423134647.GE3492@twin.jikos.cz> (raw)
In-Reply-To: <bd677611fcbd89c21d60585e22c8d4aed3b90090.1713599418.git.wqu@suse.com>
On Sat, Apr 20, 2024 at 05:20:27PM +0930, Qu Wenruo wrote:
> [BUG]
> After kernel commit 86211eea8ae1 ("btrfs: qgroup: validate
> btrfs_qgroup_inherit parameter"), user space tool snapper will fail to
> create snapshot using its timeline feature.
>
> [CAUSE]
> It turns out that, if using timeline snapper would unconditionally pass
> btrfs_qgroup_inherit parameter (assigning the new snapshot to qgroup 1/0)
> for snapshot creation.
>
> In that case, since qgroup is disabled there would be no qgroup 1/0, and
> btrfs_qgroup_check_inherit() would return -ENOENT and fail the whole
> snapshot creation.
>
> [FIX]
> Just skip the check if qgroup is not enabled.
> This is to keep the older behavior for user space tools, as if the
> kernel behavior changed for user space, it is a regression of kernel.
>
> Thankfully snapper is also fixing the behavior by detecting if qgroup is
> running in the first place, so the effect should not be that huge.
>
> Link: https://github.com/openSUSE/snapper/issues/894
> Fixes: 86211eea8ae1 ("btrfs: qgroup: validate btrfs_qgroup_inherit parameter")
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
> ---
> fs/btrfs/qgroup.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
> index 9aeb740388ab..2f55a89709b3 100644
> --- a/fs/btrfs/qgroup.c
> +++ b/fs/btrfs/qgroup.c
> @@ -3138,6 +3138,9 @@ int btrfs_qgroup_check_inherit(struct btrfs_fs_info *fs_info,
> struct btrfs_qgroup_inherit *inherit,
> size_t size)
> {
> + /* Qgroup not enabled, ignore the inherit parameter. */
Agreed with Filipe that the comment is not necessary.
prev parent reply other threads:[~2024-04-23 13:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-20 7:50 [PATCH] btrfs: qgroup: do not check qgroup inherit if qgroup is disabled Qu Wenruo
2024-04-22 16:04 ` Filipe Manana
2024-04-23 13:46 ` David Sterba [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=20240423134647.GE3492@twin.jikos.cz \
--to=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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).