Commit e1c88fd8 authored by Yongpeng Yang's avatar Yongpeng Yang Committed by Treehugger Robot
Browse files

UPSTREAM: f2fs: Add error handling for negative returns from do_garbage_collect



The function do_garbage_collect can return a value less than 0 due
to f2fs_cp_error being true or page allocation failure, as a result
of calling f2fs_get_sum_page. However, f2fs_gc does not account for
such cases, which could potentially lead to an abnormal total_freed
and thus cause subsequent code to behave unexpectedly. Given that
an f2fs_cp_error is irrecoverable, and considering that
do_garbage_collect already retries page allocation errors through
its call to f2fs_get_sum_page->f2fs_get_meta_page_retry, any error
reported by do_garbage_collect should immediately terminate the
current GC.

Signed-off-by: default avatarYongpeng Yang <yangyongpeng1@oppo.com>
Reviewed-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 19ec1d31)
Change-Id: I4741c3c406c5273c99cfd9abe1f7df19a7875fe1
parent a1995223
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment