public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Nikolay Borisov <n.borisov.lkml@gmail.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: Deadlock between block allocation and block truncation
Date: Wed, 12 Apr 2017 09:10:17 -0700	[thread overview]
Message-ID: <20170412161017.GA16590@infradead.org> (raw)
In-Reply-To: <800468eb-3ded-9166-20a4-047de8018582@gmail.com>

Hi Nikolay,

I guess the culprit is that truncate can free up to two extents in
the same transaction and thus try to lock two different AGs without
requiring them to be in increasing order.

Does the one liner below fix the problem for you?

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 7605d8396596..29f2cd5afb04 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -58,7 +58,7 @@ kmem_zone_t *xfs_inode_zone;
  * Used in xfs_itruncate_extents().  This is the maximum number of extents
  * freed from a file in a single transaction.
  */
-#define	XFS_ITRUNC_MAX_EXTENTS	2
+#define	XFS_ITRUNC_MAX_EXTENTS	1
 
 STATIC int xfs_iflush_int(struct xfs_inode *, struct xfs_buf *);
 STATIC int xfs_iunlink(struct xfs_trans *, struct xfs_inode *);

  reply	other threads:[~2017-04-12 16:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-12 15:51 Deadlock between block allocation and block truncation Nikolay Borisov
2017-04-12 16:10 ` Christoph Hellwig [this message]
2017-04-12 16:12   ` Nikolay Borisov
2017-04-12 16:20     ` Christoph Hellwig
2017-04-12 17:44   ` Nikolay Borisov
2017-04-12 17:57     ` Christoph Hellwig
2017-04-13 13:52   ` Nikolay Borisov
2017-04-14  7:42     ` Christoph Hellwig
2017-04-25  7:36       ` Christoph Hellwig

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=20170412161017.GA16590@infradead.org \
    --to=hch@infradead.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=n.borisov.lkml@gmail.com \
    /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