]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: abort transaction if we don't find extref in btrfs_del_inode_extref()
authorDavid Sterba <dsterba@suse.com>
Wed, 22 May 2024 15:28:10 +0000 (17:28 +0200)
committerDavid Sterba <dsterba@suse.com>
Thu, 11 Jul 2024 13:33:27 +0000 (15:33 +0200)
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 <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode-item.c

index 84a94d19b22c4e2f8a98041538657b06f0249b82..316756ff08acb22ea5ab8f331442c5c34405cbd6 100644 (file)
@@ -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;
        }