Re: [PATCH] xfs: mark the i_delayed_blks access in xfs_file_release as racy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 13, 2025 at 07:26:14AM +0200, Christoph Hellwig wrote:
> We don't bother with the ILOCK as this is best-effort and thus a racy
> access is ok.  Add a data_race() annotation to make that clear to
> memory model verifiers.
> 
> Reported-by: cen zhang <zzzccc427@xxxxxxxxx>
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Looks okay

Reviewed-by: Carlos Maiolino <cmaiolino@xxxxxxxxxx>

> ---
>  fs/xfs/xfs_file.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
> index 84f08c976ac4..a4a2109cb281 100644
> --- a/fs/xfs/xfs_file.c
> +++ b/fs/xfs/xfs_file.c
> @@ -1549,7 +1549,11 @@ xfs_file_release(
>  	 */
>  	if (xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED)) {
>  		xfs_iflags_clear(ip, XFS_EOFBLOCKS_RELEASED);
> -		if (ip->i_delayed_blks > 0)
> +		/*
> +		 * Don't bother with the ILOCK as this is best-effort and thus
> +		 * a racy access is ok.
> +		 */
> +		if (data_race(ip->i_delayed_blks) > 0)
>  			filemap_flush(inode->i_mapping);
>  	}
> 
> --
> 2.47.2
> 
> 




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux