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: <ayjwe2moaswosrvcv6mhd2wztwvexfjgy6dfnxxegnhppca7ac@75h6kmoj32e6>
Date: Mon, 22 Sep 2025 13:31:23 +0200
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, josef@...icpanda.com, 
	kernel-team@...com, amir73il@...il.com, linux-btrfs@...r.kernel.org, 
	linux-ext4@...r.kernel.org, linux-xfs@...r.kernel.org, ceph-devel@...r.kernel.org, 
	linux-unionfs@...r.kernel.org
Subject: Re: [PATCH v5 3/4] Manual conversion of ->i_state uses

On Fri 19-09-25 17:49:03, Mateusz Guzik wrote:
> Takes care of spots not converted by coccinelle.
> 
> Nothing to look at with one exception: smp_store_release and
> smp_load_acquire pair replaced with a manual store/load +
> smb_wmb()/smp_rmb(), see I_WB_SWITCH.
> 
> Signed-off-by: Mateusz Guzik <mjguzik@...il.com>

...

> diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
> index 0e9e96f10dd4..745df148baaa 100644
> --- a/fs/fs-writeback.c
> +++ b/fs/fs-writeback.c
> @@ -478,8 +478,8 @@ static bool inode_do_switch_wbs(struct inode *inode,
>  	 * Paired with load_acquire in unlocked_inode_to_wb_begin() and
>  	 * ensures that the new wb is visible if they see !I_WB_SWITCH.
>  	 */
> -	smp_store_release(&inode->i_state,
> -			  inode_state_read(inode) & ~I_WB_SWITCH);
> +	smp_wmb();
> +	inode_state_del(inode, I_WB_SWITCH);
>  
>  	xa_unlock_irq(&mapping->i_pages);
>  	spin_unlock(&inode->i_lock);

Comments need updating here and in backing-dev.h...

> diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
> index e721148c95d0..720e5f8ad782 100644
> --- a/include/linux/backing-dev.h
> +++ b/include/linux/backing-dev.h
> @@ -292,7 +292,8 @@ unlocked_inode_to_wb_begin(struct inode *inode, struct wb_lock_cookie *cookie)
>  	 * Paired with store_release in inode_switch_wbs_work_fn() and
>  	 * ensures that we see the new wb if we see cleared I_WB_SWITCH.
>  	 */
> -	cookie->locked = smp_load_acquire(&inode->i_state) & I_WB_SWITCH;
> +	cookie->locked = inode_state_read(inode) & I_WB_SWITCH;
> +	smp_rmb();
>  
>  	if (unlikely(cookie->locked))
>  		xa_lock_irqsave(&inode->i_mapping->i_pages, cookie->flags);

								Honza
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ