Commit 04c609e6 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Chandan Babu R

xfs: lift a xfs_valid_startblock into xfs_bmapi_allocate

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatar"Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: default avatarChandan Babu R <chandanbabu@kernel.org>
parent b11ed354
......@@ -4221,6 +4221,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)
......@@ -4713,12 +4718,6 @@ xfs_bmapi_convert_one_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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment