mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-20 19:43:58 +08:00
xfs: remove OWN_AG rmap when allocating a block from the AGFL
When we're really tight on space, xfs_alloc_ag_vextent_small() can allocate a block from the AGFL and give it to the caller. Since the caller is never the AGFL-fixing method, we must remove the OWN_AG reverse mapping because it will clash with whatever rmap the caller wants to set up. This bug was discovered by running generic/299 repeatedly. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
parent
f32866fdc9
commit
a03f1a6633
@ -1582,6 +1582,7 @@ xfs_alloc_ag_vextent_small(
|
|||||||
xfs_extlen_t *flenp, /* result length */
|
xfs_extlen_t *flenp, /* result length */
|
||||||
int *stat) /* status: 0-freelist, 1-normal/none */
|
int *stat) /* status: 0-freelist, 1-normal/none */
|
||||||
{
|
{
|
||||||
|
struct xfs_owner_info oinfo;
|
||||||
int error;
|
int error;
|
||||||
xfs_agblock_t fbno;
|
xfs_agblock_t fbno;
|
||||||
xfs_extlen_t flen;
|
xfs_extlen_t flen;
|
||||||
@ -1624,6 +1625,18 @@ xfs_alloc_ag_vextent_small(
|
|||||||
error0);
|
error0);
|
||||||
args->wasfromfl = 1;
|
args->wasfromfl = 1;
|
||||||
trace_xfs_alloc_small_freelist(args);
|
trace_xfs_alloc_small_freelist(args);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we're feeding an AGFL block to something that
|
||||||
|
* doesn't live in the free space, we need to clear
|
||||||
|
* out the OWN_AG rmap.
|
||||||
|
*/
|
||||||
|
xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_AG);
|
||||||
|
error = xfs_rmap_free(args->tp, args->agbp, args->agno,
|
||||||
|
fbno, 1, &oinfo);
|
||||||
|
if (error)
|
||||||
|
goto error0;
|
||||||
|
|
||||||
*stat = 0;
|
*stat = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user