Commit 4c1a67bd authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: set firstfsb to NULLFSBLOCK before feeding it to _bmapi_write

We must initialize the firstfsb parameter to _bmapi_write so that it
doesn't incorrectly treat stack garbage as a restriction on which AGs
it can search for free space.

Fixes-coverity-id: 1402025
Fixes-coverity-id: 1415167
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
parent 1e86eabe
......@@ -6499,6 +6499,15 @@ xfs_bmap_finish_one(
xfs_fsblock_t firstfsb;
int error = 0;
/*
* firstfsb is tied to the transaction lifetime and is used to
* ensure correct AG locking order and schedule work item
* continuations. XFS_BUI_MAX_FAST_EXTENTS (== 1) restricts us
* to only making one bmap call per transaction, so it should
* be safe to have it as a local variable here.
*/
firstfsb = NULLFSBLOCK;
trace_xfs_bmap_deferred(tp->t_mountp,
XFS_FSB_TO_AGNO(tp->t_mountp, startblock), type,
XFS_FSB_TO_AGBNO(tp->t_mountp, startblock),
......
......@@ -329,7 +329,7 @@ xfs_reflink_convert_cow_extent(
xfs_filblks_t count_fsb,
struct xfs_defer_ops *dfops)
{
xfs_fsblock_t first_block;
xfs_fsblock_t first_block = NULLFSBLOCK;
int nimaps = 1;
if (imap->br_state == XFS_EXT_NORM)
......
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