diff mbox series

[10/13] fs: Add __must_check annotations to sb_start_write_trylock() and similar

Message ID 20240807183003.23562-10-jack@suse.cz (mailing list archive)
State New
Headers show
Series fs: generic filesystem shutdown handling | expand

Commit Message

Jan Kara Aug. 7, 2024, 6:29 p.m. UTC
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@suse.cz>
---
 include/linux/fs.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

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;