diff options
| author | Qu Wenruo <wqu@suse.com> | 2026-11-02 19:58:38 +1030 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-11-23 18:20:58 +0100 |
| commit | 5588a3dd3c651824507ff57522718ea53360d1df (patch) | |
| tree | e9e929621c478e307c028117a48b73b08d47326c /tools/perf/scripts/python/bin | |
| parent | 6b456f4640f5319f1f3223cba5faddb5970ae809 (diff) | |
btrfs: reject subvolume ids that do not fit into unsigned long
fs_roots_radix is indexed by unsigned long, so on 32-bit systems the
subvolume id is silently truncated to 32 bits, e.g:
Subvolume 257 (0x101) and subvolume 4294967553 (0x100000101) will have
the same index (0x101) on 32-bit systems.
Although this should be very rare, as btrfs can reuse deleted
subvolume ids, and there are other limits like anon_dev preventing us
from so many subvolumes.
But it's still better to address such problems, since 32 bit systems are
still widely supported by the kernel.
Address such rare problem by:
- Add btrfs_check_subvolid() to btrfs_insert_fs_root()
So that all subvolumes inserted into the fs radix tree are ensured to
be no larger than ULONG_MAX.
If there is a high subvolume id, it will show an error message.
- Do not search the radix tree if subvolid is is too larger
It's possible to pass reloc tree into btrfs_lookup_fs_root() through
backref walk.
And it can be very common during qgroup operations. So we don't want
to flood the dmesg with error messages.
Just silently reject such search silently, and searching tree reloc
tree inside btrfs_lookup_fs_root() will return nothing anyway.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tools/perf/scripts/python/bin')
0 files changed, 0 insertions, 0 deletions
