diff options
author | Chao Yu <chao@kernel.org> | 2025-06-27 10:38:17 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-08-15 12:14:00 +0200 |
commit | 1f1efc11132a802abaa0d57308cf5cad25009130 (patch) | |
tree | abea1935d31a032dfbcf250e4b0bc3300885dc0f | |
parent | 46f24b1fbf6bec7d08a55e481243c885920b87d8 (diff) |
f2fs: fix to check upper boundary for gc_valid_thresh_ratio
[ Upstream commit 7a96d1d73ce9de5041e891a623b722f900651561 ]
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 <daehojeong@google.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | fs/f2fs/sysfs.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index b450046c24ab..d79d8041b8b7 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -630,6 +630,13 @@ out: 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; |