Skip to content

Commit b50f2d0

Browse files
adam900710kdave
authored andcommitted
btrfs: scrub: fix a return value overwrite in scrub_stripe()
[RETURN VALUE OVERWRITE] Inside scrub_stripe(), we would submit all the remaining stripes after iterating all extents. But since flush_scrub_stripes() can return error, we need to avoid overwriting the existing @ret if there is any error. However the existing check is doing the wrong check: ret2 = flush_scrub_stripes(); if (!ret2) ret = ret2; This would overwrite the existing @ret to 0 as long as the final flush detects no critical errors. [FIX] We should check @ret other than @ret2 in that case. Fixes: 8eb3dd1 ("btrfs: dev-replace: error out if we have unrepaired metadata error during") Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Qu Wenruo <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 745806f commit b50f2d0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/scrub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2266,7 +2266,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
22662266
}
22672267
out:
22682268
ret2 = flush_scrub_stripes(sctx);
2269-
if (!ret2)
2269+
if (!ret)
22702270
ret = ret2;
22712271
if (sctx->raid56_data_stripes) {
22722272
for (int i = 0; i < nr_data_stripes(map); i++)

0 commit comments

Comments
 (0)