[Top] [All Lists]

Re: [PATCH 2/2] xfs: move allocation stack switch up to xfs_bmapi_alloca

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 2/2] xfs: move allocation stack switch up to xfs_bmapi_allocate
From: Mark Tinguely <tinguely@xxxxxxx>
Date: Fri, 05 Oct 2012 08:28:36 -0500
Cc: xfs@xxxxxxxxxxx
In-reply-to: <1349399219-13024-3-git-send-email-david@xxxxxxxxxxxxx>
References: <1349399219-13024-1-git-send-email-david@xxxxxxxxxxxxx> <1349399219-13024-3-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20120122 Thunderbird/9.0
On 10/04/12 20:06, Dave Chinner wrote:
From: Dave Chinner<dchinner@xxxxxxxxxx>

Switching stacks are xfs_alloc_vextent can cause deadlocks when we
run out of worker threads on the allocation workqueue. This can
occur because xfs_bmap_btalloc can make multiple calls to
xfs_alloc_vextent() and even if xfs_alloc_vextent() fails it can
return with the AGF locked in the current allocation transaction.

If we then need to make another allocation, and all the allocation
worker contexts are exhausted because the are blocked waiting for
the AGF lock, holder of the AGF cannot get it's xfs-alloc_vextent
work completed to release the AGF.  Hence allocation effectively

To avoid this, move the stack switch one layer up to
xfs_bmapi_allocate() so that all of the allocation attempts in a
single switched stack transaction occur in a single worker context.
This avoids the problem of an allocation being blocked waiting for
a worker thread whilst holding the AGF.

Signed-off-by: Dave Chinner<dchinner@xxxxxxxxxx>

Looks good.

Reviewed-by: Mark Tinguely <tinguely@xxxxxxx>

<Prev in Thread] Current Thread [Next in Thread>