• Filipe Manana's avatar
    btrfs: skip transaction commit after failure to create subvolume · 1b58ae0e
    Filipe Manana authored
    At ioctl.c:create_subvol(), when we fail to create a subvolume we always
    commit the transaction. In most cases this is a no-op, since all the error
    paths, except for one, abort the transaction - the only exception is when
    we fail to insert the new root item into the root tree, in that case we
    don't abort the transaction because we didn't do anything that is
    irreversible - however we end up committing the transaction which although
    is not a functional problem, it adds unnecessary rotation of the backup
    roots in the superblock and unnecessary work.
    
    So change that to commit a transaction only when no error happened,
    otherwise just call btrfs_end_transaction() to release our reference on
    the transaction.
    Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
    Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    1b58ae0e
ioctl.c 125 KB