aboutsummaryrefslogtreecommitdiffstats
path: root/disk-io.c
diff options
context:
space:
mode:
authorWang Shilong <wangsl.fnst@cn.fujitsu.com>2014-05-28 19:20:41 +0800
committerDavid Sterba <dsterba@suse.cz>2014-08-22 14:39:33 +0200
commita764785990db3a68c09d1d5cfcfc49b5b6028179 (patch)
tree76de9a952328ccc927f8c101f40d2facc6b5a4ac /disk-io.c
parentc63d47653fc61e59f6b7d30b55982e9fe843ceef (diff)
downloadbtrfs-progs-a764785990db3a68c09d1d5cfcfc49b5b6028179.tar.gz
btrfs-progs-a764785990db3a68c09d1d5cfcfc49b5b6028179.tar.xz
btrfs-progs-a764785990db3a68c09d1d5cfcfc49b5b6028179.zip
Btrfs-progs: fsck: fix wrong check for btrfs_read_fs_root()
When encountering a corrupted fs root node, fsck hit following message: Check tree block failed, want=29360128, have=0 Check tree block failed, want=29360128, have=0 Check tree block failed, want=29360128, have=0 Check tree block failed, want=29360128, have=0 Check tree block failed, want=29360128, have=0 read block failed check_tree_block Checking filesystem on /dev/sda9 UUID: 0d295d80-bae2-45f2-a106-120dbfd0e173 checking extents Segmentation fault (core dumped) This is because in btrfs_setup_all_roots(), we check btrfs_read_fs_root() return value by verifing whether it is NULL pointer, this is wrong since btrfs_read_fs_root() return PTR_ERR(ret), fix it. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'disk-io.c')
-rw-r--r--disk-io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/disk-io.c b/disk-io.c
index 58f3f07..a54025e 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -939,7 +939,7 @@ int btrfs_setup_all_roots(struct btrfs_fs_info *fs_info, u64 root_tree_bytenr,
key.offset = (u64)-1;
fs_info->fs_root = btrfs_read_fs_root(fs_info, &key);
- if (!fs_info->fs_root)
+ if (IS_ERR(fs_info->fs_root))
return -EIO;
return 0;
}