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 --- fs/ext2/balloc.c | 1 + fs/ext2/ext2.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c index adf0f31fbddd1..53c91cb38bdee 100644 --- a/fs/ext2/balloc.c +++ b/fs/ext2/balloc.c @@ -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; diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h index 4c30d6f5c9726..b6ae29b2e6ec1 100644 --- a/fs/ext2/ext2.h +++ b/fs/ext2/ext2.h @@ -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 */ -- 2.39.5