From: Filipe Manana Date: Thu, 14 Oct 2021 16:26:04 +0000 (+0100) Subject: btrfs: fix lost error handling when replaying directory deletes X-Git-Tag: accepted/tizen/unified/20230118.172025~5997 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1084e628b8c5602d7c2091afda867030edc342b8;p=platform%2Fkernel%2Flinux-rpi.git 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: Josef Bacik Signed-off-by: Filipe Manana Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index b415c5e..ca33f10 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -2500,7 +2500,9 @@ again: 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; }