• Johannes Thumshirn's avatar
    btrfs: improve error handling of btrfs_add_link · 1690dd41
    Johannes Thumshirn authored
    In the error handling block, err holds the return value of either
    btrfs_del_root_ref() or btrfs_del_inode_ref() but it hasn't been checked
    since it's introduction with commit fe66a05a (Btrfs: improve error
    handling for btrfs_insert_dir_item callers) in 2012.
    
    If the error handling in the error handling fails, there's not much left
    to do and the abort either happened earlier in the callees or is
    necessary here.
    
    So if one of btrfs_del_root_ref() or btrfs_del_inode_ref() failed, abort
    the transaction, but still return the original code of the failure
    stored in 'ret' as this will be reported to the user.
    Signed-off-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    1690dd41
inode.c 292 KB