• Josef Bacik's avatar
    btrfs: do proper error handling in create_reloc_inode · 790c1b8c
    Josef Bacik authored
    We already handle some errors in this function, and the callers do the
    correct error handling, so clean up the rest of the function to do the
    appropriate error handling.
    
    There's a little extra work that needs to be done here, as we create the
    inode item before we create the orphan item.  We could potentially add
    the orphan item, but if we failed to create the inode item we would have
    to abort the transaction.
    
    Instead add a helper to delete the inode item we created in the case
    that we're unable to look up the inode (this would likely be caused by
    an ENOMEM), which if it succeeds means we can avoid a transaction abort
    in this particular error case.
    Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    790c1b8c
relocation.c 106 KB