ext2: annotate ext2_init_block_alloc_info() as requiring truncate_mutex

ext2_init_block_alloc_info() sets up the inode's block reservation info
and is already documented as needing truncate_mutex protection. Express
that with __must_hold() for Clang's context analysis.

Both callers (ext2_get_blocks() and ext2_ioctl()) already hold
truncate_mutex.

Signed-off-by: Timothy Day <timday@thelustrecollective.com>
Acked-by: Marco Elver <elver@google.com>
Link: https://patch.msgid.link/20260811160336.782342-6-timday@thelustrecollective.com
Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
Timothy Day 2026-08-11 12:03:33 -04:00 committed by Jan Kara
parent 023051c2d0
commit 7aa90b3c8e
2 changed files with 3 additions and 1 deletions

View File

@ -414,6 +414,7 @@ static inline int rsv_is_empty(struct ext2_reserve_window *rsv)
* Needs truncate_mutex protection prior to calling this function.
*/
void ext2_init_block_alloc_info(struct inode *inode)
__must_hold(&EXT2_I(inode)->truncate_mutex)
{
struct ext2_inode_info *ei = EXT2_I(inode);
struct ext2_block_alloc_info *block_i;

View File

@ -710,7 +710,8 @@ extern struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb,
struct buffer_head ** bh);
extern void ext2_discard_reservation (struct inode *);
extern int ext2_should_retry_alloc(struct super_block *sb, int *retries);
extern void ext2_init_block_alloc_info(struct inode *);
extern void ext2_init_block_alloc_info(struct inode *inode)
__must_hold(&EXT2_I(inode)->truncate_mutex);
extern void ext2_rsv_window_add(struct super_block *sb, struct ext2_reserve_window_node *rsv);
/* dir.c */