Re: [PATCH 3/8] xfs: lifr a xfs_valid_startblock into xfs_bmapi_allocate

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

 



On Mon, Apr 08, 2024 at 04:54:49PM +0200, Christoph Hellwig wrote:
> Subject: [PATCH 3/8] xfs: lifr a xfs_valid_startblock into xfs_bmapi_allocate

                            lift

> xfs_bmapi_convert_delalloc has a xfs_valid_startblock check on the block
> allocated by xfs_bmapi_allocate.  Lift it into xfs_bmapi_allocate as
> we should assert the same for xfs_bmapi_write.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>

With the typo fixed,
Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx>

--D

> ---
>  fs/xfs/libxfs/xfs_bmap.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> index a847159302703a..3b5816de4af2a1 100644
> --- a/fs/xfs/libxfs/xfs_bmap.c
> +++ b/fs/xfs/libxfs/xfs_bmap.c
> @@ -4230,6 +4230,11 @@ xfs_bmapi_allocate(
>  	if (bma->blkno == NULLFSBLOCK)
>  		return -ENOSPC;
>  
> +	if (WARN_ON_ONCE(!xfs_valid_startblock(bma->ip, bma->blkno))) {
> +		xfs_bmap_mark_sick(bma->ip, whichfork);
> +		return -EFSCORRUPTED;
> +	}
> +
>  	if (bma->flags & XFS_BMAPI_ZERO) {
>  		error = xfs_zero_extent(bma->ip, bma->blkno, bma->length);
>  		if (error)
> @@ -4721,12 +4726,6 @@ xfs_bmapi_convert_delalloc(
>  	if (error)
>  		goto out_finish;
>  
> -	if (WARN_ON_ONCE(!xfs_valid_startblock(ip, bma.got.br_startblock))) {
> -		xfs_bmap_mark_sick(ip, whichfork);
> -		error = -EFSCORRUPTED;
> -		goto out_finish;
> -	}
> -
>  	XFS_STATS_ADD(mp, xs_xstrat_bytes, XFS_FSB_TO_B(mp, bma.length));
>  	XFS_STATS_INC(mp, xs_xstrat_quick);
>  
> -- 
> 2.39.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