Skip to content

btrfs: eliminate a deadlock when allocating system chunks and rework chunk allocation

[email protected] linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs: fix deadlock with concurrent chunk allocations involving system chunksfs/btrfs/block-group.c fs/btrfs/transaction.c fs/btrfs/transaction.h+1 -690 replies
2/2btrfs: rework chunk allocation to avoid exhaustion of the system chunk arrayfs/btrfs/block-group.c fs/btrfs/block-group.h fs/btrfs/ctree.c +4 more+546 -1842 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by.

PatchShin'ichiro KawasakiNaohiro Aota
SeriesT-b T-b
1/2
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] btrfs: eliminate a deadlock when allocating system chunks and rework chunk allocation

From: Filipe Manana <[email protected]>

The first patch eliminates a deadlock when multiple tasks need to allocate a system chunk. It reverts a previous fix for a problem that resulted in exhausting the system chunk array and result in a transaction abort when there are many tasks allocating chunks in parallel. Since there is not a simple and short fix for the deadlock that does not bring back the system array exhaustion problem, and the deadlock is relatively easy to trigger on zoned filesystem while the exhaustion problem is not so common, this first patch just revets that previous fix.

The second patch reworks a bit of the chunk allocation code so that we don't hold onto reserved system space from phase 1 to phase 2 of chunk allocation, which is what leads to system chunk array exhaustion when there's a bunch of tasks doing chunks allocations in parallel (initially observed on PowerPC, with a 64K node size, when running the fallocate tests from stress-ng). The diff of this patch is quite big, but about half of it are just comments.

Filipe Manana (2):
btrfs: fix deadlock with concurrent chunk allocations involving system
chunks
btrfs: rework chunk allocation to avoid exhaustion of the system chunk
array

 fs/btrfs/block-group.c | 343 ++++++++++++++++++++++++++++-----------
 fs/btrfs/block-group.h |   6 +-
 fs/btrfs/ctree.c       |  67 ++------
 fs/btrfs/transaction.c |  15 +-
 fs/btrfs/transaction.h |   9 +-
 fs/btrfs/volumes.c     | 355 +++++++++++++++++++++++++++++++----------
 fs/btrfs/volumes.h     |   5 +-
 7 files changed, 547 insertions(+), 253 deletions(-)
Signature · 1 line
2.28.0