]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fs: assert on I_FREEING not being set in iput() and iput_not_last()
authorMateusz Guzik <mjguzik@gmail.com>
Mon, 1 Dec 2025 13:20:37 +0000 (14:20 +0100)
committerChristian Brauner <brauner@kernel.org>
Wed, 3 Dec 2025 10:14:50 +0000 (11:14 +0100)
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>
fs/inode.c

index cc8265cfe80e5020d890a6c0b8cf813e9076e881..521383223d8a455a2d09caff70615032213e3dfc 100644 (file)
@@ -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);