diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index e99f58b5f15c..a079eebfb080 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1865,6 +1865,9 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct f2fs_gc_control *gc_control) seg_freed = do_garbage_collect(sbi, segno, &gc_list, gc_type, gc_control->should_migrate_blocks); + if (seg_freed < 0) + goto stop; + total_freed += seg_freed; if (seg_freed == f2fs_usable_segs_in_sec(sbi, segno)) {