btrfs-progs/kernel-shared
Marek Behún 08fb534eb7 btrfs-progs: 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: Qu Wenruo <wqu@suse.com>
CC: Tom Rini <trini@konsulko.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2021-02-19 15:24:42 +01:00
..
backref.c btrfs-progs: move transaction.c to kernel-shared/ 2020-08-31 17:01:06 +02:00
backref.h btrfs-progs: move extent_io.c to kernel-shared/ 2020-08-31 17:01:04 +02:00
ctree.c btrfs-progs: print bytenr of child eb if mismatched level found in read_node_slot 2021-01-13 22:33:10 +01:00
ctree.h btrfs-progs: make btrfs_lookup_dir_index in parity with kernel code 2020-08-31 17:09:49 +02:00
delayed-ref.c btrfs-progs: move transaction.c to kernel-shared/ 2020-08-31 17:01:06 +02:00
delayed-ref.h btrfs-progs: move delayed-ref.[ch] to kernel-shared/ 2020-03-31 18:37:34 +02:00
dir-item.c btrfs-progs: make btrfs_lookup_dir_index in parity with kernel code 2020-08-31 17:09:49 +02:00
disk-io.c btrfs-progs: do not fail when offset of a ROOT_ITEM is not -1 2021-02-19 15:24:42 +01:00
disk-io.h btrfs-progs: move ctree.c to kernel-shared/ 2020-08-31 17:01:05 +02:00
extent-tree.c btrfs-progs: move volumes.c to kernel-shared/ 2020-08-31 17:01:06 +02:00
extent_io.c btrfs-progs: move volumes.c to kernel-shared/ 2020-08-31 17:01:06 +02:00
extent_io.h btrfs-progs: move extent_io.c to kernel-shared/ 2020-08-31 17:01:04 +02:00
file-item.c btrfs-progs: move transaction.c to kernel-shared/ 2020-08-31 17:01:06 +02:00
file.c btrfs-progs: move transaction.c to kernel-shared/ 2020-08-31 17:01:06 +02:00
free-space-cache.c btrfs-progs: move transaction.c to kernel-shared/ 2020-08-31 17:01:06 +02:00
free-space-cache.h btrfs-progs: move ctree.c to kernel-shared/ 2020-08-31 17:01:05 +02:00
free-space-tree.c btrfs-progs: mkfs: support free space tree as -R option 2020-09-08 22:06:04 +02:00
free-space-tree.h btrfs-progs: rename btrfs_block_group_cache to btrfs_block_group 2020-05-11 20:50:00 +02:00
inode-item.c btrfs-progs: move transaction.c to kernel-shared/ 2020-08-31 17:01:06 +02:00
inode.c btrfs-progs: make btrfs_lookup_dir_index in parity with kernel code 2020-08-31 17:09:49 +02:00
print-tree.c btrfs-progs: print the eb flags for nodes as well 2020-12-16 17:08:53 +01:00
print-tree.h btrfs-progs: move print-tree.c to kernel-shared/ 2020-08-31 17:01:05 +02:00
root-tree.c btrfs-progs: move transaction.c to kernel-shared/ 2020-08-31 17:01:06 +02:00
transaction.c btrfs-progs: move transaction.c to kernel-shared/ 2020-08-31 17:01:06 +02:00
transaction.h btrfs-progs: move transaction.c to kernel-shared/ 2020-08-31 17:01:06 +02:00
ulist.c btrfs-progs: move ctree.c to kernel-shared/ 2020-08-31 17:01:05 +02:00
ulist.h
uuid-tree.c btrfs-progs: move transaction.c to kernel-shared/ 2020-08-31 17:01:06 +02:00
volumes.c btrfs-progs: move volumes.c to kernel-shared/ 2020-08-31 17:01:06 +02:00
volumes.h btrfs-progs: move volumes.c to kernel-shared/ 2020-08-31 17:01:06 +02:00