diff options
author | Josef Bacik <josef@toxicpanda.com> | 2021-05-21 23:44:09 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-07-14 17:55:55 +0300 |
commit | 8d05e30c974f2e94d8fde4fbb112c7ef27e859c3 (patch) | |
tree | a2c8a6ec7facdb9087011a5e1578dd43fbfbec66 /fs/btrfs/delayed-inode.c | |
parent | e0ffb169a35e6fcedfc6d1e5f78f594cb152df50 (diff) | |
download | linux-8d05e30c974f2e94d8fde4fbb112c7ef27e859c3.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/btrfs/delayed-inode.c')
-rw-r--r-- | fs/btrfs/delayed-inode.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 3af06ef98b12..04422d929c23 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c @@ -1073,6 +1073,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: |