From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Sidong Yang <realwakka@gmail.com>,
dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2] btrfs-progs: common: make sure that qgroup id is in range
Date: Thu, 18 Mar 2021 10:35:18 +0800 [thread overview]
Message-ID: <b934da96-46f3-ce2a-e9a3-939f40fd4d16@gmx.com> (raw)
In-Reply-To: <20210318022208.GA34562@realwakka>
On 2021/3/18 上午10:22, Sidong Yang wrote:
> On Wed, Mar 17, 2021 at 07:36:47PM +0100, David Sterba wrote:
>> On Tue, Mar 16, 2021 at 01:27:46PM +0000, Sidong Yang wrote:
>>> When user assign qgroup with qgroup id that is too big to exceeds
>>> range and invade level value, and it works without any error. but
>>> this action would be make undefined error. this code make sure that
>>> qgroup id doesn't exceed range(0 ~ 2^48-1).
>>
>> Should the level be also validate? The function parse_qgroupid does not
>> do full validation, so eg 0//0 would be parsed as a path and not as a
>> typo, level larger than 64K will be silently clamped.
>
> I agree. 0//0 would be parsed as path but it failed in
> btrfs_util_is_subvolume() and goes to err. I understand that upper 16
> bits of qgroupid is for level. so, The valid llevel range is [0~2^16-1].
> But I can't get it that level larger than 64K will be clampled.
>
> one more question about that, I see that the ioctl calls just store the
> qgroupid without any opeartion with level. is the level meaningless in
> kernel?
>
No, kernel uses the qgroup level, but it's deep in qgroup code.
In fact, kernel treats qgroupid just as an u64, and sometimes checks the
qgroup level for relationship, but under most cases, it's just a u64,
level/id doesn't really matter that much.
Thanks,
Qu
next prev parent reply other threads:[~2021-03-18 2:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-16 13:27 [PATCH v2] btrfs-progs: common: make sure that qgroup id is in range Sidong Yang
2021-03-17 1:51 ` Qu Wenruo
2021-03-17 18:36 ` David Sterba
2021-03-18 2:22 ` Sidong Yang
2021-03-18 2:35 ` Qu Wenruo [this message]
2021-03-18 20:34 ` David Sterba
2021-03-19 16:44 ` Sidong Yang
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=b934da96-46f3-ce2a-e9a3-939f40fd4d16@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=realwakka@gmail.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