summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Guzik <mjguzik@gmail.com>2025-12-01 14:20:37 +0100
committerChristian Brauner <brauner@kernel.org>2025-12-03 11:14:50 +0100
commitaa8aba61d4e17e23ae048098b81f65840a7d5722 (patch)
tree790d114d14abf86a2ee339cd0f993775375c5334
parent222047f68e8565c558728f792f6fef152a1d4d51 (diff)
fs: assert on I_FREEING not being set in iput() and iput_not_last()
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com> Link: https://patch.msgid.link/20251201132037.22835-1-mjguzik@gmail.com Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Christian Brauner <brauner@kernel.org>
-rw-r--r--fs/inode.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/inode.c b/fs/inode.c
index cc8265cfe80e..521383223d8a 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1968,7 +1968,7 @@ void iput(struct inode *inode)
retry:
lockdep_assert_not_held(&inode->i_lock);
- VFS_BUG_ON_INODE(inode_state_read_once(inode) & I_CLEAR, inode);
+ VFS_BUG_ON_INODE(inode_state_read_once(inode) & (I_FREEING | I_CLEAR), inode);
/*
* Note this assert is technically racy as if the count is bogusly
* equal to one, then two CPUs racing to further drop it can both
@@ -2010,6 +2010,7 @@ EXPORT_SYMBOL(iput);
*/
void iput_not_last(struct inode *inode)
{
+ VFS_BUG_ON_INODE(inode_state_read_once(inode) & (I_FREEING | I_CLEAR), inode);
VFS_BUG_ON_INODE(atomic_read(&inode->i_count) < 2, inode);
WARN_ON(atomic_sub_return(1, &inode->i_count) == 0);