Thread (10 messages) 10 messages, 6 authors, 2021-07-02

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

From: Naohiro Aota <Naohiro.Aota@wdc.com>
Date: 2021-07-01 07:15:14

On Tue, Jun 29, 2021 at 02:43:04PM +0100, fdmanana@kernel.org wrote:
From: Filipe Manana <redacted>

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(-)

-- 
2.28.0
Thanks for the patches.

I could run btrfs/232 100 times without hungs.

Tested-by: Naohiro Aota <naohiro.aota@wdc.com>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help