Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed023134 authored by Filipe Manana's avatar Filipe Manana Committed by Greg Kroah-Hartman
Browse files

btrfs: fix lost error handling when replaying directory deletes



commit 10adb1152d957a4d570ad630f93a88bb961616c1 upstream.

At replay_dir_deletes(), if find_dir_range() returns an error we break out
of the main while loop and then assign a value of 0 (success) to the 'ret'
variable, resulting in completely ignoring that an error happened. Fix
that by jumping to the 'out' label when find_dir_range() returns an error
(negative value).

CC: stable@vger.kernel.org # 4.4+
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9d985857
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2412,7 +2412,9 @@ static noinline int replay_dir_deletes(struct btrfs_trans_handle *trans,
		else {
			ret = find_dir_range(log, path, dirid, key_type,
					     &range_start, &range_end);
			if (ret != 0)
			if (ret < 0)
				goto out;
			else if (ret > 0)
				break;
		}