summaryrefslogtreecommitdiff
path: root/fs/btrfs/delayed-inode.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2021-05-21 23:44:09 +0300
committerDavid Sterba <dsterba@suse.com>2021-06-21 16:19:05 +0300
commit04587ad9bef6ce9d510325b4ba9852b6129eebdb (patch)
tree2e15ebf3da6f69e22fa7704f44ab649cba1128f0 /fs/btrfs/delayed-inode.c
parentbb385bedded3ccbd794559600de4a09448810f4a (diff)
downloadlinux-04587ad9bef6ce9d510325b4ba9852b6129eebdb.tar.xz
btrfs: abort transaction if we fail to update the delayed inode
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>
Diffstat (limited to 'fs/btrfs/delayed-inode.c')
-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 bce7bdd7fe03..2c18ed23aa27 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -1051,6 +1051,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: