]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
f2fs: fix wrong continue condition in GC
authorJaegeuk Kim <jaegeuk@kernel.org>
Sat, 13 Aug 2022 05:49:50 +0000 (22:49 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Oct 2022 07:56:53 +0000 (09:56 +0200)
commit 605b0a778aa2599aa902ae639b8e9937c74b869b upstream.

We should decrease the frozen counter.

Cc: stable@vger.kernel.org
Fixes: 325163e9892b ("f2fs: add gc_urgent_high_remaining sysfs node")
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/f2fs/gc.c

index d5fb426e07474300147b32da984ab3f1648251a0..a12c28693ed15181a2bf665b4be9141379f94f18 100644 (file)
@@ -97,14 +97,10 @@ static int gc_thread_func(void *data)
                 */
                if (sbi->gc_mode == GC_URGENT_HIGH) {
                        spin_lock(&sbi->gc_urgent_high_lock);
-                       if (sbi->gc_urgent_high_limited) {
-                               if (!sbi->gc_urgent_high_remaining) {
-                                       sbi->gc_urgent_high_limited = false;
-                                       spin_unlock(&sbi->gc_urgent_high_lock);
-                                       sbi->gc_mode = GC_NORMAL;
-                                       continue;
-                               }
-                               sbi->gc_urgent_high_remaining--;
+                       if (sbi->gc_urgent_high_limited &&
+                                       !sbi->gc_urgent_high_remaining--) {
+                               sbi->gc_urgent_high_limited = false;
+                               sbi->gc_mode = GC_NORMAL;
                        }
                        spin_unlock(&sbi->gc_urgent_high_lock);
                }