From eb34d143711ac8607ab6abdc6f0b7f13fd8f8287 Mon Sep 17 00:00:00 2001 From: Timothy Day Date: Tue, 11 Aug 2026 12:03:30 -0400 Subject: [PATCH] ext2: annotate ext2_update_dynamic_rev() as requiring s_lock ext2_update_dynamic_rev() modifies several fields within 'struct ext2_super_block' and is already documented as requiring s_lock. Express that with __must_hold() for Clang's context analysis. Both callers ext2_xattr_update_super_block() and __ext2_write_inode() already hold s_lock. Signed-off-by: Timothy Day Acked-by: Marco Elver Link: https://patch.msgid.link/20260811160336.782342-3-timday@thelustrecollective.com Signed-off-by: Jan Kara --- fs/ext2/ext2.h | 3 ++- fs/ext2/super.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h index 690452808d24..2ace014ed43c 100644 --- a/fs/ext2/ext2.h +++ b/fs/ext2/ext2.h @@ -761,7 +761,8 @@ extern __printf(3, 4) void ext2_error(struct super_block *, const char *, const char *, ...); extern __printf(3, 4) void ext2_msg(struct super_block *, const char *, const char *, ...); -extern void ext2_update_dynamic_rev (struct super_block *sb); +extern void ext2_update_dynamic_rev(struct super_block *sb) + __must_hold(&EXT2_SB(sb)->s_lock); extern void ext2_sync_super(struct super_block *sb, struct ext2_super_block *es, int wait); diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 3d64b28745d3..27f32637d1b8 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -127,6 +127,7 @@ void ext2_msg(struct super_block *sb, const char *prefix, * This must be called with sbi->s_lock held. */ void ext2_update_dynamic_rev(struct super_block *sb) + __must_hold(&EXT2_SB(sb)->s_lock) { struct ext2_super_block *es = EXT2_SB(sb)->s_es;