Skip to contentSkip to conversation

f2fs: fix to check upper boundary for gc_valid_thresh_ratio

PATCH Applied Chao Yu 2 participants 3 messages Jun 27, 2025 – Jul 9, 2025 F2FS file system

lore
Share & tools
lore

Chao Yu

author maintainer
#0 lore raw

PATCH 1/2 f2fs: fix to check upper boundary for gc_valid_thresh_ratio

This patch adds missing upper boundary check while setting gc_valid_thresh_ratio via sysfs.

Fixes e791d00bd06c ("f2fs: add valid block ratio not to do excessive GC for one time GC")
Cc Daeho Jeong <[email protected]>
---
 fs/f2fs/sysfs.c | 7 +++++++
 1 file changed, 7 insertions(+)
fs/f2fs/sysfs.c +7 -0
index 2b5c35ce7b8c..d74472d96026 100644
@@ -635,6 +635,13 @@ static ssize_t __sbi_store(struct f2fs_attr *a,
 		return count;
 	}
 
+	if (!strcmp(a->attr.name, "gc_valid_thresh_ratio")) {
+		if (t > 100)
+			return -EINVAL;
+		*ui = (unsigned int)t;
+		return count;
+	}
+
 #ifdef CONFIG_F2FS_IOSTAT
 	if (!strcmp(a->attr.name, "iostat_enable")) {
 		sbi->iostat_enable = !!t;
Signature · 1 line
2.49.0
author maintainer
#1 lore raw

PATCH 2/2 f2fs: fix to check upper boundary for gc_no_zoned_gc_percent

This patch adds missing upper boundary check while setting gc_no_zoned_gc_percent via sysfs.

Fixes 9a481a1c16f4 ("f2fs: create gc_no_zoned_gc_percent and gc_boost_zoned_gc_percent")
Cc Daeho Jeong <[email protected]>
---
 fs/f2fs/sysfs.c | 7 +++++++
 1 file changed, 7 insertions(+)
fs/f2fs/sysfs.c +7 -0
index d74472d96026..bdef926b3377 100644
@@ -628,6 +628,13 @@ static ssize_t __sbi_store(struct f2fs_attr *a,
 		return count;
 	}
 
+	if (!strcmp(a->attr.name, "gc_no_zoned_gc_percent")) {
+		if (t > 100)
+			return -EINVAL;
+		*ui = (unsigned int)t;
+		return count;
+	}
+
 	if (!strcmp(a->attr.name, "gc_boost_zoned_gc_percent")) {
 		if (t > 100)
 			return -EINVAL;
Signature · 1 line
2.49.0
#2 lore raw
In reply to Chao Yu
This series was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <[email protected]>:

Hello:

This series was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:

Quoted 8 lines · On Fri, 27 Jun 2025 10:38:17 +0800 you wrote:

This patch adds missing upper boundary check while setting gc_valid_thresh_ratio via sysfs.

Fixes e791d00bd06c ("f2fs: add valid block ratio not to do excessive GC for one time GC")
Cc Daeho Jeong <[email protected]>

[...]

Here is the summary with links:
- [f2fs-dev,1/2] f2fs: fix to check upper boundary for gc_valid_thresh_ratio

    https://git.kernel.org/jaegeuk/f2fs/c/7a96d1d73ce9
  - [f2fs-dev,2/2] f2fs: fix to check upper boundary for gc_no_zoned_gc_percent
    https://git.kernel.org/jaegeuk/f2fs/c/a919ae794ad2

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html