lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250828-redeverbot-material-2e2f9f71d9b7@brauner>
Date: Thu, 28 Aug 2025 14:40:25 +0200
From: Christian Brauner <brauner@...nel.org>
To: Josef Bacik <josef@...icpanda.com>
Cc: linux-fsdevel@...r.kernel.org, linux-btrfs@...r.kernel.org, 
	kernel-team@...com, linux-ext4@...r.kernel.org, linux-xfs@...r.kernel.org, 
	viro@...iv.linux.org.uk, amir73il@...il.com
Subject: Re: [PATCH v2 48/54] fs: remove some spurious I_FREEING references
 in inode.c

On Tue, Aug 26, 2025 at 11:39:48AM -0400, Josef Bacik wrote:
> Now that we have the i_count reference count rules set so that we only
> go into these evict paths with a 0 count, update the sanity checks to
> check that instead of I_FREEING.
> 
> Signed-off-by: Josef Bacik <josef@...icpanda.com>
> ---
>  fs/inode.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/inode.c b/fs/inode.c
> index eb74f7b5e967..da38c9fbb9a7 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -858,7 +858,7 @@ void clear_inode(struct inode *inode)
>  	 */
>  	xa_unlock_irq(&inode->i_data.i_pages);
>  	BUG_ON(!list_empty(&inode->i_data.i_private_list));
> -	BUG_ON(!(inode->i_state & I_FREEING));
> +	BUG_ON(icount_read(inode) != 0);
>  	BUG_ON(inode->i_state & I_CLEAR);
>  	BUG_ON(!list_empty(&inode->i_wb_list));

These should probably all be WARN_ON()s.

>  	/* don't need i_lock here, no concurrent mods to i_state */
> @@ -871,19 +871,19 @@ EXPORT_SYMBOL(clear_inode);
>   * to. We remove any pages still attached to the inode and wait for any IO that
>   * is still in progress before finally destroying the inode.
>   *
> - * An inode must already be marked I_FREEING so that we avoid the inode being
> + * An inode must already have an i_count of 0 so that we avoid the inode being
>   * moved back onto lists if we race with other code that manipulates the lists
>   * (e.g. writeback_single_inode). The caller is responsible for setting this.
>   *
>   * An inode must already be removed from the LRU list before being evicted from
> - * the cache. This should occur atomically with setting the I_FREEING state
> - * flag, so no inodes here should ever be on the LRU when being evicted.
> + * the cache. This should always be the case as the LRU list holds an i_count
> + * reference on the inode, and we only evict inodes with an i_count of 0.
>   */
>  static void evict(struct inode *inode)
>  {
>  	const struct super_operations *op = inode->i_sb->s_op;
>  
> -	BUG_ON(!(inode->i_state & I_FREEING));
> +	BUG_ON(icount_read(inode) != 0);
>  	BUG_ON(!list_empty(&inode->i_lru));
>  
>  	if (!list_empty(&inode->i_io_list))
> @@ -897,8 +897,8 @@ static void evict(struct inode *inode)
>  	/*
>  	 * Wait for flusher thread to be done with the inode so that filesystem
>  	 * does not start destroying it while writeback is still running. Since
> -	 * the inode has I_FREEING set, flusher thread won't start new work on
> -	 * the inode.  We just have to wait for running writeback to finish.
> +	 * the inode has a 0 i_count, flusher thread won't start new work on the
> +	 * inode.  We just have to wait for running writeback to finish.
>  	 */
>  	inode_wait_for_writeback(inode);
>  	spin_unlock(&inode->i_lock);
> -- 
> 2.49.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ