From: Josef Bacik Date: Fri, 21 May 2021 20:44:09 +0000 (-0400) Subject: btrfs: abort transaction if we fail to update the delayed inode X-Git-Tag: v4.9.276~202 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c8c6262d299464b25025eff9f048604225695cfc;p=thirdparty%2Fkernel%2Fstable.git 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 Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 4d8f8a8c9c908..29e75fba53765 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c @@ -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: