fs: add might_sleep() annotation to iput() and more
authorMax Kellermann <max.kellermann@ionos.com>
Wed, 17 Sep 2025 15:36:31 +0000 (17:36 +0200)
committerChristian Brauner <brauner@kernel.org>
Fri, 19 Sep 2025 12:14:55 +0000 (14:14 +0200)
commit2ef435a872abc347dc0a92f1c213bb0af3cbf195
tree64fe33c027b36fd48c60112b59a70e2c01292bf8
parentcde560f98a9b6e64dd675f6bd10137cc8243a32a
fs: add might_sleep() annotation to iput() and more

When iput() drops the reference counter to zero, it may sleep via
inode_wait_for_writeback().  This happens rarely because it's usually
the dcache which evicts inodes, but really iput() should only ever be
called in contexts where sleeping is allowed.  This annotation allows
finding buggy callers.

Additionally, this patch annotates a few low-level functions that can
call iput() conditionally.

Cc: Mateusz Guzik <mjguzik@gmail.com>
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
Link: https://lore.kernel.org/20250917153632.2228828-1-max.kellermann@ionos.com
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/inode.c