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>
This commit is contained in:
Josef Bacik 2021-05-21 16:44:09 -04:00 committed by Greg Kroah-Hartman
parent 504081c415
commit af4b53f6d3
1 changed files with 8 additions and 0 deletions

View 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: