]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
btrfs: abort transaction if we fail to update the delayed inode
authorJosef Bacik <josef@toxicpanda.com>
Fri, 21 May 2021 20:44:09 +0000 (16:44 -0400)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 13 Aug 2021 07:45:11 +0000 (09:45 +0200)
BugLink: https://bugs.launchpad.net/bugs/1938199
[ Upstream commit 04587ad9bef6ce9d510325b4ba9852b6129eebdb ]

If we fail to update the delayed inode we need to abort the transaction,
because we could leave an inode with the improper counts or some other
such corruption behind.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
fs/btrfs/delayed-inode.c

index c93254c9d67a12a8cb86c9344e670b13847f348a..3dccbbe4a65857cc9c2f9370baf9b427329f2b24 100644 (file)
@@ -1074,6 +1074,14 @@ err_out:
        btrfs_delayed_inode_release_metadata(fs_info, node, (ret < 0));
        btrfs_release_delayed_inode(node);
 
+       /*
+        * If we fail to update the delayed inode we need to abort the
+        * transaction, because we could leave the inode with the improper
+        * counts behind.
+        */
+       if (ret && ret != -ENOENT)
+               btrfs_abort_transaction(trans, ret);
+
        return ret;
 
 search: