• Liu Bo's avatar
    Btrfs: fix read_node_slot to return errors · fb770ae4
    Liu Bo authored
    We use read_node_slot() to read btree node and it has two cases,
    a) slot is out of range, which means 'no such entry'
    b) we fail to read the block, due to checksum fails or corrupted
       content or not with uptodate flag.
    But we're returning NULL in both cases, this makes it return -ENOENT
    in case a) and return -EIO in case b), and this fixes its callers
    as well as btrfs_search_forward() 's caller to catch the new errors.
    
    The problem is reported by Peter Becker, and I can manage to
    hit the same BUG_ON by mounting my fuzz image.
    Reported-by: default avatarPeter Becker <floyd.net@gmail.com>
    Signed-off-by: default avatarLiu Bo <bo.li.liu@oracle.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    fb770ae4
tree-log.c 152 KB