btrfs: handle errors in walk_down_tree properly
authorJosef Bacik <josef@toxicpanda.com>
Tue, 7 Feb 2023 16:57:24 +0000 (11:57 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 17 Apr 2023 16:01:13 +0000 (18:01 +0200)
commit4e19438400ce6d4a6251829ac045ba680ad48bb4
treecad4aa2333afa6a630eef326b826958e2c97b07a
parent6989627db074a3db0ca297657bcb8709d8c888c0
btrfs: handle errors in walk_down_tree properly

We can get errors in walk_down_proc as we try and lookup extent info for
the snapshot dropping to act on.  However if we get an error we simply
return 1 which indicates we're done with walking down, which will lead
us to improperly continue with the snapshot drop with the incorrect
information.  Instead break if we get any error from walk_down_proc or
do_walk_down, and handle the case of ret == 1 by returning 0, otherwise
return the ret value that we have.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c