From f4f89477322295e0f0ea10aa3e617afe2a827fc5 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Wed, 22 May 2024 17:28:10 +0200 Subject: btrfs: abort transaction if we don't find extref in btrfs_del_inode_extref() When an extended ref is deleted we do a sanity check right before removing the item, if we can't find it then handle the error. This is done by btrfs_handle_fs_error() but this is from the time before we had the transaction abort infrastructure, so switch to that. The end result is the same, the error is reported and switched to read-only. We newly return the -ENOENT error code as this better represents what happened. Reviewed-by: Qu Wenruo Signed-off-by: David Sterba --- fs/btrfs/inode-item.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'fs/btrfs') diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c index 84a94d19b22c..316756ff08ac 100644 --- a/fs/btrfs/inode-item.c +++ b/fs/btrfs/inode-item.c @@ -141,8 +141,8 @@ static int btrfs_del_inode_extref(struct btrfs_trans_handle *trans, extref = btrfs_find_name_in_ext_backref(path->nodes[0], path->slots[0], ref_objectid, name); if (!extref) { - btrfs_handle_fs_error(root->fs_info, -ENOENT, NULL); - ret = -EROFS; + btrfs_abort_transaction(trans, -ENOENT); + ret = -ENOENT; goto out; } -- cgit v1.2.3