u-boot-brain/fs/btrfs
Marek Behún 1afb9f2222 fs: btrfs: do not fail when offset of a ROOT_ITEM is not -1
When the btrfs_read_fs_root() function is searching a ROOT_ITEM with
location key offset other than -1, it currently fails via BUG_ON.

The offset can have other value than -1, though. This can happen for
example if a subvolume is renamed:

  $ btrfs subvolume create X && sync
  Create subvolume './X'
  $ btrfs inspect-internal dump-tree /dev/root | grep -B 2 'name: X$
        location key (270 ROOT_ITEM 18446744073709551615) type DIR
        transid 283 data_len 0 name_len 1
        name: X
  $ mv X Y && sync
  $ btrfs inspect-internal dump-tree /dev/root | grep -B 2 'name: Y$
        location key (270 ROOT_ITEM 0) type DIR
        transid 285 data_len 0 name_len 1
        name: Y

As can be seen the offset changed from -1ULL to 0.

Do not fail in this case.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: David Sterba <dsterba@suse.com>
Cc: Qu Wenruo <wqu@suse.com>
Cc: Tom Rini <trini@konsulko.com>
2021-03-01 09:53:46 -05:00
..
common fs: btrfs: Crossport rbtree-utils from btrfs-progs 2020-09-07 20:57:27 -04:00
crypto fs: btrfs: Add more checksum algorithms 2020-09-07 20:57:27 -04:00
kernel-shared fs: btrfs: Sync btrfs_btree.h from kernel 2020-09-07 20:57:27 -04:00
btrfs.c fs: btrfs: change directory list output to be aligned as before 2021-02-24 16:51:48 -05:00
btrfs.h fs: btrfs: Cleanup the old implementation 2020-09-07 21:00:36 -04:00
compat.h fs: btrfs: Introduce function to resolve path in one subvolume 2020-09-07 21:00:36 -04:00
compression.c fs: btrfs: Cleanup the old implementation 2020-09-07 21:00:36 -04:00
conv-funcs.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
ctree.c fs: btrfs: Cleanup the old implementation 2020-09-07 21:00:36 -04:00
ctree.h fs: btrfs: Cleanup the old implementation 2020-09-07 21:00:36 -04:00
dev.c common: Drop part.h from common header 2020-05-18 17:33:33 -04:00
dir-item.c fs: btrfs: Cleanup the old implementation 2020-09-07 21:00:36 -04:00
disk-io.c fs: btrfs: do not fail when offset of a ROOT_ITEM is not -1 2021-03-01 09:53:46 -05:00
disk-io.h fs: btrfs: Cleanup the old implementation 2020-09-07 21:00:36 -04:00
extent-cache.c fs: btrfs: Crossport extent-cache.[ch] from btrfs-progs 2020-09-07 20:57:27 -04:00
extent-cache.h fs: btrfs: Crossport extent-cache.[ch] from btrfs-progs 2020-09-07 20:57:27 -04:00
extent-io.c fs: btrfs: Cleanup the old implementation 2020-09-07 21:00:36 -04:00
extent-io.h fs: btrfs: Crossport extent-io.[ch] from btrfs-progs 2020-09-07 20:57:27 -04:00
inode.c fs: btrfs: inode: handle uninitialized type before returning it 2020-11-19 09:45:49 -05:00
Kconfig fs: btrfs: Select SHA256 in Kconfig 2021-01-29 10:36:49 -05:00
Makefile fs: btrfs: Cleanup the old implementation 2020-09-07 21:00:36 -04:00
root-tree.c fs: btrfs: Crossport open_ctree_fs_info() from btrfs-progs 2020-09-07 20:57:27 -04:00
subvolume.c fs: btrfs: Cleanup the old implementation 2020-09-07 21:00:36 -04:00
volumes.c fs: btrfs: volumes: prevent overflow for multiplying 2021-01-20 14:01:08 -05:00
volumes.h fs: btrfs: Crossport btrfs_read_sys_array() and btrfs_read_chunk_tree() 2020-09-07 20:57:27 -04:00