]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: tree-log: check btrfs_lookup_data_extent return value
authorMarcos Paulo de Souza <mpdesouza@suse.com>
Mon, 2 Aug 2021 12:34:00 +0000 (09:34 -0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 23 Aug 2021 11:19:15 +0000 (13:19 +0200)
commit25a445366c76d0018043f4e4aabb13509311d62c
treec16788f334528d3ae9ad73ab37d6f5783a5043a9
parent5cd35ecadc2d3189e35838f99ea099ec17ca9335
btrfs: tree-log: check btrfs_lookup_data_extent return value

Function btrfs_lookup_data_extent calls btrfs_search_slot to verify if
the EXTENT_ITEM exists in the extent tree. btrfs_search_slot can return
values bellow zero if an error happened.

Function replay_one_extent currently checks if the search found
something (0 returned) and increments the reference, and if not, it
seems to evaluate as 'not found'.

Fix the condition by checking if the value was bellow zero and return
early.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tree-log.c