diff options
author | Filipe Manana <fdmanana@suse.com> | 2025-07-11 20:48:23 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2025-07-22 01:14:02 +0200 |
commit | 24e066ded45b8147b79c7455ac43a5bff7b5f378 (patch) | |
tree | 399c2b34ea8d2dd1bf09e3ec57bd92e4d10b1070 /scripts/gdb/linux/pgtable.py | |
parent | 7ebf381a69421a88265d3c49cd0f007ba7336c9d (diff) |
btrfs: don't skip remaining extrefs if dir not found during log replay
During log replay, at add_inode_ref(), if we have an extref item that
contains multiple extrefs and one of them points to a directory that does
not exist in the subvolume tree, we are supposed to ignore it and process
the remaining extrefs encoded in the extref item, since each extref can
point to a different parent inode. However when that happens we just
return from the function and ignore the remaining extrefs.
The problem has been around since extrefs were introduced, in commit
f186373fef00 ("btrfs: extended inode refs"), but it's hard to hit in
practice because getting extref items encoding multiple extref requires
getting a hash collision when computing the offset of the extref's
key. The offset if computed like this:
key.offset = btrfs_extref_hash(dir_ino, name->name, name->len);
and btrfs_extref_hash() is just a wrapper around crc32c().
Fix this by moving to next iteration of the loop when we don't find
the parent directory that an extref points to.
Fixes: f186373fef00 ("btrfs: extended inode refs")
CC: stable@vger.kernel.org # 6.1+
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'scripts/gdb/linux/pgtable.py')
0 files changed, 0 insertions, 0 deletions