]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
btrfs: abort transaction on failure to update root in the received subvol ioctl
authorFilipe Manana <fdmanana@suse.com>
Fri, 27 Feb 2026 00:02:33 +0000 (00:02 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 3 Mar 2026 16:03:59 +0000 (17:03 +0100)
If we failed to update the root we don't abort the transaction, which is
wrong since we already used the transaction to remove an item from the
uuid tree.

Fixes: dd5f9615fc5c ("Btrfs: maintain subvolume items in the UUID tree")
CC: stable@vger.kernel.org # 3.12+
Reviewed-by: Anand Jain <asj@kernel.org>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c

index 56d17eedaf903b7a3ecde04083dcc0ec1bb14454..5805ac2078f2cdedc9b6ee6e0d9e65987873ee69 100644 (file)
@@ -3984,7 +3984,8 @@ static long _btrfs_ioctl_set_received_subvol(struct file *file,
 
        ret = btrfs_update_root(trans, fs_info->tree_root,
                                &root->root_key, &root->root_item);
-       if (ret < 0) {
+       if (unlikely(ret < 0)) {
+               btrfs_abort_transaction(trans, ret);
                btrfs_end_transaction(trans);
                goto out;
        }