Skip to content

Commit

Permalink
f2fs: avoid to create an empty string as the extension_list
Browse files Browse the repository at this point in the history
When creating a file, we need to set the temperature based on
extension_list. If the empty string is a valid extension_list,
the is_extension_exist will always returns true,
which affects the separation of hot and cold.

Signed-off-by: Wang Xiaojun <wangxiaojun11@huawei.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
  • Loading branch information
Wang Xiaojun authored and Jaegeuk Kim committed Jul 13, 2021
1 parent 01f6afd commit 5417c98
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/f2fs/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ static ssize_t __sbi_store(struct f2fs_attr *a,
set = false;
}

if (strlen(name) >= F2FS_EXTENSION_LEN)
if (!strlen(name) || strlen(name) >= F2FS_EXTENSION_LEN)
return -EINVAL;

down_write(&sbi->sb_lock);
Expand Down

0 comments on commit 5417c98

Please sign in to comment.