1

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 <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2024-05-22 17:28:10 +02:00
parent eba1469f8f
commit f4f8947732

View 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], extref = btrfs_find_name_in_ext_backref(path->nodes[0], path->slots[0],
ref_objectid, name); ref_objectid, name);
if (!extref) { if (!extref) {
btrfs_handle_fs_error(root->fs_info, -ENOENT, NULL); btrfs_abort_transaction(trans, -ENOENT);
ret = -EROFS; ret = -ENOENT;
goto out; goto out;
} }