diff options
| author | Nathan Chancellor <nathan@kernel.org> | 2026-10-23 14:25:02 -0700 |
|---|---|---|
| committer | Jan Kara <jack@suse.cz> | 2026-10-26 14:19:22 +0100 |
| commit | afb28ca1f1ebe5279ffedd2fb24b92b8ee968351 (patch) | |
| tree | 6c57e834efa32e39c5be817704cf7068c178c4e2 /tools/perf/scripts/python/task-analyzer.py | |
| parent | 0415c2624f8be6eac60de2b298de195dd18802d8 (diff) | |
ext2: Make sbi an proper alias for EXT2_SB(sb) in ext2_fill_super()
A recent LLVM change to fix parsing and validating __guarded_by on
structure members [1] reveals a couple of warnings in ext2_fill_super()
from the annotations added by commit 023051c2d0f1 ("ext2: mark
s_mount_state as guarded by s_lock") and commit c23746524faf ("ext2:
annotate s_rsv_window_root as requiring s_rsv_window_lock"):
fs/ext2/super.c:1040:7: error: writing variable 's_mount_state' requires holding spinlock '_res->s_lock' exclusively [-Werror,-Wthread-safety-precise]
1040 | sbi->s_mount_state = le16_to_cpu(es->s_state);
| ^
fs/ext2/super.c:1040:7: note: found near match 'EXT2_SB(sb).s_lock'
fs/ext2/super.c:1138:8: error: writing variable 's_rsv_window_root' requires holding spinlock '_res->s_rsv_window_lock' exclusively [-Werror,-Wthread-safety-precise]
1138 | sbi->s_rsv_window_root = RB_ROOT;
| ^
fs/ext2/super.c:1138:8: note: found near match 'EXT2_SB(sb).s_rsv_window_lock'
Context analysis does very minimal alias detection [2], so it is not
able to figure out that sbi == sb->s_fs_info == EXT2_SB(sb). The only
reason there were no warnings before the above LLVM change is because
the annotation was not parsed and verified correctly.
Rework the allocation and assignment of sbi to have a direct assignment
of EXT2_SB(sb) to sbi so that the analysis knows that sbi and
EXT2_SB(sb) refer to the same object, clearing up the warnings.
Fixes: 9708538ba204 ("ext2: enable context analysis support for ext2 filesystem")
Link: https://github.com/llvm/llvm-project/commit/217e229a1f32785fccdd3b3f51429f0d309dea45 [1]
Link: https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#no-alias-analysis [2]
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Marco Elver <elver@google.com>
Link: https://patch.msgid.link/20261023-ext2-fix-context-analysis-clang-24-v2-1-a33961453899@kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'tools/perf/scripts/python/task-analyzer.py')
0 files changed, 0 insertions, 0 deletions
