summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2021-05-21 23:44:09 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-14 17:53:14 +0300
commitaf4b53f6d3eae04b27634b0045a9367d6b7ad27e (patch)
tree0afd0bdc0045acd3118ee8e5e8244476e5098362 /fs
parent504081c415e20a0378d29d1db7728b2b98ec7d0d (diff)
downloadlinux-af4b53f6d3eae04b27634b0045a9367d6b7ad27e.tar.xz
btrfs: abort transaction if we fail to update the delayed inode
[ 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>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/delayed-inode.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index c93254c9d67a..3dccbbe4a658 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -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: