diff options
author | Dave Chinner <dchinner@redhat.com> | 2023-04-27 09:02:11 +1000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-05-30 14:17:22 +0100 |
commit | 74475bc78dd993f17492844f404da41932d8b4eb (patch) | |
tree | 19e06e164d0ba5b4a7c4d3ffa9270564474a571f /virt | |
parent | fc618fe6c55f307a15cbbd1b2da962fbe41c2274 (diff) | |
download | linux-stable-74475bc78dd993f17492844f404da41932d8b4eb.tar.gz linux-stable-74475bc78dd993f17492844f404da41932d8b4eb.tar.bz2 linux-stable-74475bc78dd993f17492844f404da41932d8b4eb.zip |
xfs: fix livelock in delayed allocation at ENOSPC
commit 9419092fb2630c30e4ffeb9ef61007ef0c61827a upstream.
On a filesystem with a non-zero stripe unit and a large sequential
write, delayed allocation will set a minimum allocation length of
the stripe unit. If allocation fails because there are no extents
long enough for an aligned minlen allocation, it is supposed to
fall back to unaligned allocation which allows single block extents
to be allocated.
When the allocator code was rewritting in the 6.3 cycle, this
fallback was broken - the old code used args->fsbno as the both the
allocation target and the allocation result, the new code passes the
target as a separate parameter. The conversion didn't handle the
aligned->unaligned fallback path correctly - it reset args->fsbno to
the target fsbno on failure which broke allocation failure detection
in the high level code and so it never fell back to unaligned
allocations.
This resulted in a loop in writeback trying to allocate an aligned
block, getting a false positive success, trying to insert the result
in the BMBT. This did nothing because the extent already was in the
BMBT (merge results in an unchanged extent) and so it returned the
prior extent to the conversion code as the current iomap.
Because the iomap returned didn't cover the offset we tried to map,
xfs_convert_blocks() then retries the allocation, which fails in the
same way and now we have a livelock.
Reported-and-tested-by: Brian Foster <bfoster@redhat.com>
Fixes: 85843327094f ("xfs: factor xfs_bmap_btalloc()")
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'virt')
0 files changed, 0 insertions, 0 deletions