lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 22 Oct 2022 01:46:32 +0800
From:   Yangtao Li <frank.li@...o.com>
To:     jaegeuk@...nel.org, chao@...nel.org
Cc:     linux-f2fs-devel@...ts.sourceforge.net,
        linux-kernel@...r.kernel.org, Yangtao Li <frank.li@...o.com>
Subject: [PATCH 1/2] f2fs: fix gc mode when gc_urgent_high_remaining is 1

Under the current logic, when gc_urgent_high_remaining is set to 1,
the mode will be switched to normal at the beginning, instead of
running in gc_urgent mode.

Let's switch the gc mode back to normal when the gc ends.

Fixes: 265576181b4a ("f2fs: remove gc_urgent_high_limited for cleanup")

Signed-off-by: Yangtao Li <frank.li@...o.com>
---
 fs/f2fs/gc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 4546e01b2ee0..2f113fbcb85c 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -45,6 +45,7 @@ static int gc_thread_func(void *data)
 	set_freezable();
 	do {
 		bool sync_mode, foreground = false;
+		bool gc_normal_mode = false;
 
 		wait_event_interruptible_timeout(*wq,
 				kthread_should_stop() || freezing(current) ||
@@ -101,7 +102,7 @@ static int gc_thread_func(void *data)
 			if (sbi->gc_urgent_high_remaining) {
 				sbi->gc_urgent_high_remaining--;
 				if (!sbi->gc_urgent_high_remaining)
-					sbi->gc_mode = GC_NORMAL;
+					gc_normal_mode = true;
 			}
 			spin_unlock(&sbi->gc_urgent_high_lock);
 		}
@@ -162,6 +163,10 @@ static int gc_thread_func(void *data)
 		/* balancing f2fs's metadata periodically */
 		f2fs_balance_fs_bg(sbi, true);
 next:
+		if (gc_normal_mode) {
+			sbi->gc_mode = GC_NORMAL;
+			gc_normal_mode = false;
+		}
 		sb_end_write(sbi->sb);
 
 	} while (!kthread_should_stop());
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ