Skip to content

Commit b8b902f

Browse files
Yongpeng YangJaegeuk Kim
authored andcommitted
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 <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent ed78aee commit b8b902f

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

fs/f2fs/namei.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,21 @@ int f2fs_update_extension_list(struct f2fs_sb_info *sbi, const char *name,
8383
if (set) {
8484
if (total_count == F2FS_MAX_EXTENSION)
8585
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+
}
86101
} else {
87102
if (!hot && !cold_count)
88103
return -EINVAL;

0 commit comments

Comments
 (0)