Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

f2fs: disallow setting an extension to both cold and hot

An extension should not exist in both the cold and hot extension lists
simultaneously. When adding a hot extension, check whether it already
exists in the cold list, and vice versa. Reject the operation with
-EINVAL if a conflict is found.

Signed-off-by: Yongpeng Yang <yangyongpeng@xiaomi.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

authored by

Yongpeng Yang and committed by
Jaegeuk Kim
b8b902fd ed78aeeb

+15
+15
fs/f2fs/namei.c
··· 83 83 if (set) { 84 84 if (total_count == F2FS_MAX_EXTENSION) 85 85 return -EINVAL; 86 + 87 + if (hot) { 88 + start = 0; 89 + count = cold_count; 90 + } else { 91 + start = cold_count; 92 + count = total_count; 93 + } 94 + for (i = start; i < count; i++) { 95 + if (!strcmp(name, extlist[i])) { 96 + f2fs_warn(sbi, "extension '%s' already exists in %s list", 97 + name, hot ? "cold" : "hot"); 98 + return -EINVAL; 99 + } 100 + } 86 101 } else { 87 102 if (!hot && !cold_count) 88 103 return -EINVAL;