• Josef Bacik's avatar
    btrfs: handle errors in btrfs_reloc_clone_csums properly · aa5ccf29
    Josef Bacik authored
    In the cow path we will clone the reloc csums for relocated data
    extents, and if there's an error we already have an ordered extent and
    rely on the ordered extent finishing to clean everything up.
    
    There's a problem however, we don't mark the ordered extent with an
    error, we pretend like everything was just fine.  If we were at the end
    of our range we won't actually bubble up this error anywhere, and we
    could end up inserting an extent that doesn't have csums where it should
    have them.
    
    Fix this by adding a helper to mark the ordered extent with an error,
    and then use this when we fail to lookup the csums in
    btrfs_reloc_clone_csums.  Use this helper in the other place where we
    use the same pattern while we're here.
    
    This will prevent us from erroneously inserting the extent that doesn't
    have the required checksums.
    Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
    Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    aa5ccf29
relocation.c 117 KB