]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:20:59 +0000 (16:20 +0200)
[ 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>
fs/btrfs/delayed-inode.c

index 4d8f8a8c9c908d9d83cf5cdbbc91480599bbe1fb..29e75fba53765b95a2f208a7f572db7facf38ac5 100644 (file)
@@ -1076,6 +1076,14 @@ err_out:
        btrfs_delayed_inode_release_metadata(root, node);
        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: