Commit a214fe0
workqueue: fix parse_affn_scope() prefix matching bug
parse_affn_scope() uses strncasecmp() with the length of the candidate
name, which means it only checks if the input *starts with* a known
scope name.
Given that the upcoming diff will create "cache_shard" affinity scope,
writing "cache_shard" to a workqueue's affinity_scope sysfs attribute
always matches "cache" first, making it impossible to select
"cache_shard" via sysfs, so, this fix enable it to distinguish "cache"
and "cache_shard"
Fix by replacing the hand-rolled prefix matching loop with
sysfs_match_string(), which uses sysfs_streq() for exact matching
(modulo trailing newlines). Also add the missing const qualifier to
the wq_affn_names[] array declaration.
Note that sysfs_streq() is case-sensitive, unlike the previous
strncasecmp() approach. This is intentional and consistent with
how other sysfs attributes handle string matching in the kernel.
Signed-off-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 1abaae9)
Signed-off-by: Carol L Soto <csoto@nvidia.com>1 parent 0ccf98e commit a214fe0
1 file changed
Lines changed: 2 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
415 | | - | |
| 415 | + | |
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
| |||
7090 | 7090 | | |
7091 | 7091 | | |
7092 | 7092 | | |
7093 | | - | |
7094 | | - | |
7095 | | - | |
7096 | | - | |
7097 | | - | |
7098 | | - | |
7099 | | - | |
| 7093 | + | |
7100 | 7094 | | |
7101 | 7095 | | |
7102 | 7096 | | |
| |||
0 commit comments