Re: [PATCH] xfs: fix frozen file system assert in xfs_trans_alloc

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

 



On Thu, Jul 31, 2025 at 07:19:41AM -0700, Christoph Hellwig wrote:
> Commit 83a80e95e797 ("xfs: decouple xfs_trans_alloc_empty from
> xfs_trans_alloc") move the place of the assert for a frozen file system
> after the sb_start_intwrite call that ensures it doesn't run on frozen
> file systems, and thus allows to incorrect trigger it.
> 
> Fix that by moving it back to where it belongs.
> 
> Fixes: 83a80e95e797 ("xfs: decouple xfs_trans_alloc_empty from xfs_trans_alloc")
> Reported-by: Dave Chinner <david@xxxxxxxxxxxxx>
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> ---
>  fs/xfs/xfs_trans.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
> index 4917b7d390a3..9010dd682591 100644
> --- a/fs/xfs/xfs_trans.c
> +++ b/fs/xfs/xfs_trans.c
> @@ -253,8 +253,8 @@ xfs_trans_alloc(
>  	 * by doing GFP_KERNEL allocations inside sb_start_intwrite().
>  	 */
>  retry:
> -	WARN_ON(mp->m_super->s_writers.frozen == SB_FREEZE_COMPLETE);
>  	tp = __xfs_trans_alloc(mp, flags);
> +	WARN_ON(mp->m_super->s_writers.frozen == SB_FREEZE_COMPLETE);

Empty transactions can run during a freeze, so please put back the
original warning and comment:

	/*
	 * Zero-reservation ("empty") transactions can't modify anything, so
	 * they're allowed to run while we're frozen.
	 */
	WARN_ON(resp->tr_logres > 0 &&
		mp->m_super->s_writers.frozen == SB_FREEZE_COMPLETE);

--D

>  	error = xfs_trans_reserve(tp, resp, blocks, rtextents);
>  	if (error == -ENOSPC && want_retry) {
>  		xfs_trans_cancel(tp);
> -- 
> 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