The callers of sb_start_write_trylock(), sb_start_intwrite_trylock(), file_start_write_trylock() must check the return value to figure out whether the protection has been acquired (and thus must be dropped) or not. Add __must_check annotation to these functions to catch forgotten checks early. Signed-off-by: Jan Kara <jack@xxxxxxx> --- include/linux/fs.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index 952f11170296..755a4c83a2bf 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1828,7 +1828,7 @@ static inline void sb_start_write(struct super_block *sb) __sb_start_write(sb, SB_FREEZE_WRITE); } -static inline bool sb_start_write_trylock(struct super_block *sb) +static inline bool __must_check sb_start_write_trylock(struct super_block *sb) { return __sb_start_write_trylock(sb, SB_FREEZE_WRITE); } @@ -1875,7 +1875,8 @@ static inline void sb_start_intwrite(struct super_block *sb) __sb_start_write(sb, SB_FREEZE_FS); } -static inline bool sb_start_intwrite_trylock(struct super_block *sb) +static inline bool __must_check sb_start_intwrite_trylock( + struct super_block *sb) { return __sb_start_write_trylock(sb, SB_FREEZE_FS); } @@ -2894,7 +2895,7 @@ static inline int __must_check file_start_write(struct file *file) return 0; } -static inline bool file_start_write_trylock(struct file *file) +static inline bool __must_check file_start_write_trylock(struct file *file) { if (!S_ISREG(file_inode(file)->i_mode)) return true; -- 2.35.3