Re: [PATCH v2] xfs: _{attr,data}_map_shared should take ILOCK_EXCL until iread_extents is completely done

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

 



On Tue, Apr 11, 2023 at 11:49:34AM -0700, Darrick J. Wong wrote:
> @@ -226,10 +226,15 @@ xfs_iformat_data_fork(
>  
>  	/*
>  	 * Initialize the extent count early, as the per-format routines may
> -	 * depend on it.
> +	 * depend on it.  Use release semantics to set needextents /after/ we
> +	 * set the format. This ensures that we can use acquire semantics on
> +	 * needextents in xfs_need_iread_extents() and be guaranteed to see a
> +	 * valid format value after that load.
>  	 */
>  	ip->i_df.if_format = dip->di_format;
>  	ip->i_df.if_nextents = xfs_dfork_data_extents(dip);
> +	smp_store_release(&ip->i_df.if_needextents,
> +			   ip->i_df.if_format == XFS_DINODE_FMT_BTREE ? 1 : 0);

ip->i_df is memset to zero a little earlier (same for the attr fork),
this only needs to be:

	if (ip->i_df.if_format == XFS_DINODE_FMT_BTREE)
		smp_store_release(&ip->i_df.if_needextents, 1);



[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