diff options
| author | Timothy Day <timday@thelustrecollective.com> | 2026-08-11 12:03:33 -0400 |
|---|---|---|
| committer | Jan Kara <jack@suse.cz> | 2026-09-01 15:40:36 +0200 |
| commit | 7aa90b3c8ef8f936f7db310bc9ec60eba26cd726 (patch) | |
| tree | 5b96a00b7016a58f8646f2a2f2718c147e9577e1 | |
| parent | 023051c2d0f1d782da1bd0b09092f31592b46f3a (diff) | |
| download | linux-next-7aa90b3c8ef8f936f7db310bc9ec60eba26cd726.tar.gz linux-next-7aa90b3c8ef8f936f7db310bc9ec60eba26cd726.zip | |
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>
| -rw-r--r-- | fs/ext2/balloc.c | 1 | ||||
| -rw-r--r-- | fs/ext2/ext2.h | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c index adf0f31fbddd..53c91cb38bde 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 800200b342c4..4b1622eec2af 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 */ |
