linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Alex Lyakas <alex@zadarastorage.com>
Cc: linux-xfs@vger.kernel.org, bfoster@redhat.com,
	darrick.wong@oracle.com, libor.klepac@bcom.cz
Subject: Re: [PATCH] xfs: hold xfs_buf locked between shortform->leaf conversion and the addition of an attribute
Date: Thu, 10 Aug 2017 21:33:22 +1000	[thread overview]
Message-ID: <20170810113322.GM21024@dastard> (raw)
In-Reply-To: <185A1C4516684B439A3711999ABACA79@alyakaslap>

On Thu, Aug 10, 2017 at 11:02:12AM +0300, Alex Lyakas wrote:
> Hi Dave,
> 
> Let's sayf that xfs_defer_finish() commits the current transaction
> and the buffer has been held. Then xfs_defer_finish() opens the next
> transaction. The buffer that has been held is not joined to the
> second transaction, i.e., the second transaction knows nothing about
> this buffer, is that correct?

Yes.

> If so, the caller now holds the buffer
> exclusively, and he has one of two options:
> - release the buffer explicitly
> - join the buffer to some transaction

That's correct, but that's not the problem I see. :/

The problem is that the locked buffer is not joined and logged in
the rolling transactions run in xfs_defer_ops. Hence it can pin the
tail of the AIL, and this can prevent the transaction roll from
regranting the log space necessary to continue rolling the
transaction for the required number of transactions to complete the
deferred ops. If this happens, we end up with a log space deadlock.

Hence if we are holding an item that we logged in a transaction
locked and we roll the transaction, we have to join, hold and log it
in each subsequent transaction until we have finished with the item
and can unlock and release it.

This is documented in xfs_trans_roll():

        /*
         * Reserve space in the log for th next transaction.
         * This also pushes items in the "AIL", the list of logged items,
         * out to disk if they are taking up space at the tail of the log
         * that we want to use.  This requires that either nothing be locked
         * across this call, or that anything that is locked be logged in
         * the prior and the next transactions.
         */


Cheers,

Dave.

-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2017-08-10 11:33 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-09 11:06 [PATCH] xfs: hold xfs_buf locked between shortform->leaf conversion and the addition of an attribute alex
2017-08-09 13:17 ` Brian Foster
2017-08-09 21:33 ` Dave Chinner
2017-08-10  8:02   ` Alex Lyakas
2017-08-10 11:33     ` Dave Chinner [this message]
2017-08-10 12:09       ` Alex Lyakas
2017-08-10 14:52         ` Brian Foster
2017-08-10 17:55           ` Darrick J. Wong
2017-08-10 18:32             ` Brian Foster
2017-08-11  2:22               ` Dave Chinner
2017-08-11 14:27                 ` Brian Foster
2017-08-12  0:16                   ` Dave Chinner
2017-08-12 14:04                     ` Brian Foster
2017-08-14  0:28                       ` Dave Chinner
2017-08-14  8:11                         ` Alex Lyakas
2017-08-14 12:22                           ` Brian Foster
2017-08-14 16:04                             ` Alex Lyakas
2017-08-14 21:33                               ` Darrick J. Wong
2019-03-22  9:12                             ` Shyam Kaushik
2019-03-22 16:08                               ` Darrick J. Wong
2019-03-25 13:49                                 ` Shyam Kaushik
2019-03-25 18:17                                   ` Darrick J. Wong
2019-03-27 16:03                                     ` Alex Lyakas
2019-03-27 20:46                                       ` Dave Chinner
2019-03-28 11:26                                         ` Alex Lyakas
2017-08-17 20:38                         ` Brian Foster
2017-08-17 22:31                           ` Darrick J. Wong
2017-08-18 11:39                             ` Brian Foster
2017-08-18 15:37                               ` Darrick J. Wong
2017-08-18  2:04                           ` Dave Chinner
2017-08-18 11:42                             ` Brian Foster
2017-08-11  2:09             ` Dave Chinner
2017-08-11 14:30               ` Brian Foster
2017-08-11 12:53   ` Christoph Hellwig
2017-08-11 16:52     ` Darrick J. Wong
2017-08-12  7:37       ` Christoph Hellwig
2017-11-21 15:31 ` Libor Klepáč
2017-11-21 16:24   ` Brian Foster
2017-11-21 18:50     ` Darrick J. Wong
2017-11-30 17:55       ` Darrick J. Wong

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=20170810113322.GM21024@dastard \
    --to=david@fromorbit.com \
    --cc=alex@zadarastorage.com \
    --cc=bfoster@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=libor.klepac@bcom.cz \
    --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;
as well as URLs for NNTP newsgroup(s).