public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Chandan Babu R <chandanrlinux@gmail.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/2] xfs: Prevent deadlock when allocating blocks for AGFL
Date: Thu, 6 May 2021 13:27:51 +1000	[thread overview]
Message-ID: <20210506032751.GN63242@dread.disaster.area> (raw)
In-Reply-To: <874kfh5p32.fsf@garuda>

On Wed, May 05, 2021 at 06:12:41PM +0530, Chandan Babu R wrote:
> > Hence when doing allocation for the free list, we need to fail the
> > allocation rather than block on the only remaining free extent in
> > the AG. If we are freeing extents, the AGFL not being full is not an
> > issue at all. And if we are allocating extents, the transaction
> > reservations should have ensured that the AG had sufficient space in
> > it to complete the entire operation without deadlocking waiting for
> > space.
> >
> > Either way, I don't see a problem with making sure the AGFL
> > allocations just skip busy extents and fail if the only free extents
> > are ones this transaction has freed itself.
> >
> 
> Hmm. In the scenario where *all* free extents in the AG were originally freed
> by the current transaction (and hence busy in the transaction),

How does that happen? 

> we would need
> to be able to recognize this situation and skip invoking
> xfs_extent_busy_flush() altogether.

If we are freeing extents (i.e XFS_ALLOC_FLAG_FREEING is set) and
we are doing allocation for AGFL and we only found busy extents,
then it's OK to fail the allocation.

We have options here - once we get to the end of the btree and
haven't found a candidate that isn't busy, we could fail
immediately. Or maybe we try an optimisitic flush which forces the
log and waits for as short while (instead of forever) for the
generation to change and then fail if we get a timeout response. Or
maybe there's a more elegant way of doing this that hasn't yet
rattled out of my poor, overloaded brain right now.

Just because we currently do a blocking flush doesn't mean we always
must do a blocking flush....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2021-05-06  3:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-28  6:51 [PATCH 1/2] xfs: Introduce XFS_EXTENT_BUSY_IN_TRANS busy extent flag Chandan Babu R
2021-04-28  6:51 ` [PATCH 2/2] xfs: Prevent deadlock when allocating blocks for AGFL Chandan Babu R
2021-04-29  1:12   ` Dave Chinner
2021-04-30 13:40     ` Chandan Babu R
2021-04-30 22:44       ` Dave Chinner
2021-05-03  9:52         ` Chandan Babu R
2021-05-04  0:03           ` Dave Chinner
2021-05-05 12:42             ` Chandan Babu R
2021-05-06  3:27               ` Dave Chinner [this message]
2021-05-11 11:49                 ` Chandan Babu R
2021-06-17  4:48                   ` Chandan Babu R
  -- strict thread matches above, loose matches on Subject: below --
2023-01-10 12:24 Xiao Guangrong
2023-01-10 12:48 ` Chandan Babu R
2023-01-11  3:14   ` Xiao Guangrong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210506032751.GN63242@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=chandanrlinux@gmail.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox