* [BUG] XFS (delalloc) writeback livelock writing to -ENOSPC on dm-thin
@ 2023-04-21 11:02 Brian Foster
2023-04-21 22:27 ` Dave Chinner
0 siblings, 1 reply; 2+ messages in thread
From: Brian Foster @ 2023-04-21 11:02 UTC (permalink / raw)
To: linux-xfs; +Cc: Dave Chinner
Hi all,
The test case is a simple sequential write to XFS backed by a thin
volume. The test vm is running latest 6.3.0-rc7, has 8xcpu and 8GB RAM,
and the thin volume is backed by sufficient space in the thin pool.
I.e.:
lvcreate --type thin-pool -n tpool -L30G test
lvcreate -V 20G -n tvol test/tpool
mkfs.xfs /dev/test/tvol
mount /dev/test/tvol /mnt
dd if=/dev/zero of=/mnt/file bs=1M
The dd command writes until ~1GB or so free space is left in the fs and
then seems to hit a livelock. From a quick look at tracepoints, XFS
seems to be spinning in the xfs_convert_blocks() writeback path. df
shows space consumption no longer changing, the flush worker is spinning
at 100% and dd is blocked in balance_dirty_pages(). If I kill dd, the
writeback worker continues spinning and an fsync of the file blocks
indefinitely.
If I reset the vm, remount and run the following:
dd if=/dev/zero of=/mnt/file bs=1M conv=notrunc oflag=append
... it then runs to -ENOSPC, as expected.
I haven't seen this occur when running on a non-thin lvm volume, not
sure why. What is also interesting is that if I rm the file and repeat
on the thin volume (so the the thin volume is pretty much fully mapped
at this point), the problem still occurs.
This doesn't reproduce on v6.2. Given the number of XFS changes and the
behavior above, it sort of smells more like an XFS issue than dm, but
I've no real evidence of that. Regardless, I ran a bisect over related
XFS commits and it implicated either of the two following commits:
85843327094f ("xfs: factor xfs_bmap_btalloc()")
74c36a8689d3 ("xfs: use xfs_alloc_vextent_this_ag() where appropriate")
More specifically, 85843327094f is the first commit that conclusively
exhibits the problem. 74c36a8689d3 is inconclusive because I run into an
almost instant shutdown when running the test. If I take one more step
back to commit 4811c933ea1a ("xfs: combine __xfs_alloc_vextent_this_ag
and xfs_alloc_ag_vextent"), the problem doesn't occur.
Brian
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [BUG] XFS (delalloc) writeback livelock writing to -ENOSPC on dm-thin
2023-04-21 11:02 [BUG] XFS (delalloc) writeback livelock writing to -ENOSPC on dm-thin Brian Foster
@ 2023-04-21 22:27 ` Dave Chinner
0 siblings, 0 replies; 2+ messages in thread
From: Dave Chinner @ 2023-04-21 22:27 UTC (permalink / raw)
To: Brian Foster; +Cc: linux-xfs, Dave Chinner
On Fri, Apr 21, 2023 at 07:02:39AM -0400, Brian Foster wrote:
> Hi all,
>
> The test case is a simple sequential write to XFS backed by a thin
> volume. The test vm is running latest 6.3.0-rc7, has 8xcpu and 8GB RAM,
> and the thin volume is backed by sufficient space in the thin pool.
> I.e.:
>
> lvcreate --type thin-pool -n tpool -L30G test
> lvcreate -V 20G -n tvol test/tpool
> mkfs.xfs /dev/test/tvol
> mount /dev/test/tvol /mnt
> dd if=/dev/zero of=/mnt/file bs=1M
>
> The dd command writes until ~1GB or so free space is left in the fs and
> then seems to hit a livelock. From a quick look at tracepoints, XFS
> seems to be spinning in the xfs_convert_blocks() writeback path. df
> shows space consumption no longer changing, the flush worker is spinning
> at 100% and dd is blocked in balance_dirty_pages(). If I kill dd, the
> writeback worker continues spinning and an fsync of the file blocks
> indefinitely.
>
> If I reset the vm, remount and run the following:
>
> dd if=/dev/zero of=/mnt/file bs=1M conv=notrunc oflag=append
>
> ... it then runs to -ENOSPC, as expected.
>
> I haven't seen this occur when running on a non-thin lvm volume, not
> sure why.
thinp volumes trigger stripe alignment in mkfs, which then use
different allocation strategies at writeback time.
Patch to fix it already sent to the list.
-Dave.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-21 22:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-21 11:02 [BUG] XFS (delalloc) writeback livelock writing to -ENOSPC on dm-thin Brian Foster
2023-04-21 22:27 ` Dave Chinner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox