• Brian Foster's avatar
    xfs: fix contiguous dquot chunk iteration livelock · 2192b0ba
    Brian Foster authored
    The patch below updated xfs_dq_get_next_id() to use the XFS iext
    lookup helpers to locate the next quota id rather than to seek for
    data in the quota file. The updated code fails to correctly handle
    the case where the quota inode might have contiguous chunks part of
    the same extent. In this case, the start block offset is calculated
    based on the next expected id but the extent lookup returns the same
    start offset as for the previous chunk. This causes the returned id
    to go backwards and livelocks the quota iteration. This problem is
    reproduced intermittently by generic/232.
    
    To handle this case, check whether the startoff from the extent
    lookup is behind the startoff calculated from the next quota id. If
    so, bump up got.br_startoff to the specific file offset that is
    expected to hold the next dquot chunk.
    
    Fixes: bda250db ("xfs: rewrite xfs_dq_get_next_id using xfs_iext_lookup_extent")
    Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    2192b0ba
xfs_dquot.c 29.8 KB