[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <y4z3hvwqmae5yngcqjivli2sddyza6hwni4gcmkgpbbz2ojaqd@gqrewfuy3alv>
Date: Tue, 2 Dec 2025 11:29:10 +0100
From: Jan Kara <jack@...e.cz>
To: Mateusz Guzik <mjguzik@...il.com>
Cc: brauner@...nel.org, viro@...iv.linux.org.uk, jack@...e.cz,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] fs: assert on I_FREEING not being set in iput() and
iput_not_last()
On Mon 01-12-25 14:20:37, Mateusz Guzik wrote:
> Signed-off-by: Mateusz Guzik <mjguzik@...il.com>
Makes sense. Feel free to add:
Reviewed-by: Jan Kara <jack@...e.cz>
Honza
> ---
> fs/inode.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> 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);
> --
> 2.48.1
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists