Skip to content

Commit 2bb83bc

Browse files
maharmstonekdave
authored andcommitted
btrfs: show correct warning if can't read data reloc tree
If a filesystem is missing its data reloc tree, we get something like this in dmesg: BTRFS warning (device loop11): failed to read root (objectid=4): -2 BTRFS error (device loop11): open_ctree failed: -2 objectid is BTRFS_DEV_TREE_OBJECTID, but this should actually be the value of BTRFS_DATA_RELOC_TREE_OBJECTID. btrfs_read_roots() prints location.objectid on failure, but this isn't set when reading the data reloc tree. Set location.objectid to the correct value on failure, so that the error message makes sense. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Mark Harmstone <mark@harmstone.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 530e3d4 commit 2bb83bc

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

fs/btrfs/disk-io.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,6 +2255,7 @@ static int btrfs_read_roots(struct btrfs_fs_info *fs_info)
22552255
BTRFS_DATA_RELOC_TREE_OBJECTID, true);
22562256
if (IS_ERR(root)) {
22572257
if (!btrfs_test_opt(fs_info, IGNOREBADROOTS)) {
2258+
location.objectid = BTRFS_DATA_RELOC_TREE_OBJECTID;
22582259
ret = PTR_ERR(root);
22592260
goto out;
22602261
}

0 commit comments

Comments
 (0)