Commit 601a87b8 authored by Josef Bacik's avatar Josef Bacik Committed by Kleber Sacilotto de Souza

btrfs: abort transaction after failed inode updates in create_subvol

BugLink: https://bugs.launchpad.net/bugs/1858462

[ Upstream commit c7e54b51 ]

We can just abort the transaction here, and in fact do that for every
other failure in this function except these two cases.

CC: stable@vger.kernel.org # 4.4+
Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
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>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 9a673218
...@@ -594,12 +594,18 @@ static noinline int create_subvol(struct inode *dir, ...@@ -594,12 +594,18 @@ static noinline int create_subvol(struct inode *dir,
btrfs_i_size_write(dir, dir->i_size + namelen * 2); btrfs_i_size_write(dir, dir->i_size + namelen * 2);
ret = btrfs_update_inode(trans, root, dir); ret = btrfs_update_inode(trans, root, dir);
BUG_ON(ret); if (ret) {
btrfs_abort_transaction(trans, root, ret);
goto fail;
}
ret = btrfs_add_root_ref(trans, root->fs_info->tree_root, ret = btrfs_add_root_ref(trans, root->fs_info->tree_root,
objectid, root->root_key.objectid, objectid, root->root_key.objectid,
btrfs_ino(dir), index, name, namelen); btrfs_ino(dir), index, name, namelen);
BUG_ON(ret); if (ret) {
btrfs_abort_transaction(trans, root, ret);
goto fail;
}
ret = btrfs_uuid_tree_add(trans, root->fs_info->uuid_root, ret = btrfs_uuid_tree_add(trans, root->fs_info->uuid_root,
root_item.uuid, BTRFS_UUID_KEY_SUBVOL, root_item.uuid, BTRFS_UUID_KEY_SUBVOL,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment