Re: [PATCH v2 0/8] Support Clang context analysis for ext2

Marco Elver <[email protected]>
Newsgroups org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-ext4,org.kernel.vger.linux-kernel
Message-ID <CANpmjNPOY5D9rdGVCwPhS5XqQuJvnP+0zG6=XNL2QLqOE6iJag@mail.gmail.com>
On Tue, 11 Aug 2026 at 18:04, Timothy Day
<[email protected]> wrote:
>
> This description is mostly copied from v1:
>
> This series adds annotations for Clang's context analysis to ext2.
> Clang context analysis was recently added in a series by Marco
> Elver [1]. This allows the compiler to validate different
> locking patterns at compile time.
>
> This series enables context analysis, fixes pre-existing warnings,
> and adds new annotations. It is inspired by similar series in the
> block layer (NVMe host driver, for example [2]).
>
> I'm starting with ext2 since it's smaller and simpler compared to
> ext4/btrfs/etc. After ext2, I'd be interested in converting the
> other filesystems and infrastructure code in fs/. I think the ultimate
> goal would be to enable this by default across all of fs/.
>
> The series was built and tested with Clang 23 with
> CONFIG_WARN_CONTEXT_ANALYSIS enabled. I based on 7.2-rc7.
>
> Thanks!
>
> Changes from v1:
>
> * A false positive has been fixed in Clang [3] and ported to Clang 23.
>   Hence, the first patch (silencing that false positive) has been dropped.
> * Use guard() and scoped_guard() instead of context_unsafe(), when
>   possible, to express that certain fields are being protected by a newly
>   initialized lock during init.

Acked-by: Marco Elver <[email protected]>

But ultimately up to maintainers. Also, thanks for helping improve the
Clang side (FWIW, Clang 23 will release August 23)!

> Link to v1: https://lore.kernel.org/linux-fsdevel/[email protected]/
>
> [1] https://lore.kernel.org/lkml/[email protected]/
> [2] https://lore.kernel.org/all/[email protected]/
> [3] https://github.com/llvm/llvm-project/pull/209796
>
> Timothy Day (8):
>   ext2: mark s_next_generation as guarded by s_next_gen_lock
>   ext2: annotate ext2_update_dynamic_rev() as requiring s_lock
>   ext2: mark statfs overhead cache as guarded by s_lock
>   ext2: mark s_mount_state as guarded by s_lock
>   ext2: annotate ext2_init_block_alloc_info() as requiring
>     truncate_mutex
>   ext2: annotate block-mapping helpers as requiring truncate_mutex
>   ext2: annotate s_rsv_window_root as requiring s_rsv_window_lock
>   ext2: enable context analysis support for ext2 filesystem
>
>  fs/ext2/Makefile |  2 ++
>  fs/ext2/balloc.c |  4 ++++
>  fs/ext2/ext2.h   | 19 +++++++++++--------
>  fs/ext2/inode.c  |  7 +++++++
>  fs/ext2/super.c  | 35 +++++++++++++++++++----------------
>  5 files changed, 43 insertions(+), 24 deletions(-)
>
> --
> 2.43.0
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.