From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Subject: [PATCH 3/4] xfs: fix stray dquot unlock when reclaiming dquots
Date: Wed, 28 Nov 2012 13:01:02 +1100 [thread overview]
Message-ID: <1354068063-1692-4-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1354068063-1692-1-git-send-email-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
When we fail to get a dquot lock during reclaim, we jump to an error
handler that unlocks the dquot. This is wrong as we didn't lock the
dquot, and unlocking it means who-ever is holding the lock has had
it silently taken away, and hence it results in a lock imbalance.
Found by inspection while modifying the code for the numa-lru
patchset. This fixes a random hang I've been seeing on xfstest 232
for the past several months.
cc: <stable@vger.kernel.org>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/xfs_qm.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index e6a0af0..60eff47 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -1456,7 +1456,7 @@ xfs_qm_dqreclaim_one(
int error;
if (!xfs_dqlock_nowait(dqp))
- goto out_busy;
+ goto out_move_tail;
/*
* This dquot has acquired a reference in the meantime remove it from
@@ -1479,7 +1479,7 @@ xfs_qm_dqreclaim_one(
* getting flushed to disk, we don't want to reclaim it.
*/
if (!xfs_dqflock_nowait(dqp))
- goto out_busy;
+ goto out_unlock_move_tail;
if (XFS_DQ_IS_DIRTY(dqp)) {
struct xfs_buf *bp = NULL;
@@ -1490,7 +1490,7 @@ xfs_qm_dqreclaim_one(
if (error) {
xfs_warn(mp, "%s: dquot %p flush failed",
__func__, dqp);
- goto out_busy;
+ goto out_unlock_move_tail;
}
xfs_buf_delwri_queue(bp, buffer_list);
@@ -1499,7 +1499,7 @@ xfs_qm_dqreclaim_one(
* Give the dquot another try on the freelist, as the
* flushing will take some time.
*/
- goto out_busy;
+ goto out_unlock_move_tail;
}
xfs_dqfunlock(dqp);
@@ -1518,14 +1518,13 @@ xfs_qm_dqreclaim_one(
XFS_STATS_INC(xs_qm_dqreclaims);
return;
-out_busy:
- xfs_dqunlock(dqp);
-
/*
* Move the dquot to the tail of the list so that we don't spin on it.
*/
+out_unlock_move_tail:
+ xfs_dqunlock(dqp);
+out_move_tail:
list_move_tail(&dqp->q_lru, &qi->qi_lru_list);
-
trace_xfs_dqreclaim_busy(dqp);
XFS_STATS_INC(xs_qm_dqreclaim_misses);
}
--
1.7.10
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2012-11-28 1:58 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-28 2:00 [PATCH 0/4] xfs: patch queue for 3.8 Dave Chinner
2012-11-28 2:01 ` [PATCH 1/4] xfs: fix direct IO nested transaction deadlock Dave Chinner
2012-11-28 13:27 ` Christoph Hellwig
2012-11-28 2:01 ` [PATCH 2/4] xfs: byte range granularity for XFS_IOC_ZERO_RANGE Dave Chinner
2012-11-28 13:33 ` Christoph Hellwig
2012-11-29 0:06 ` Christoph Hellwig
2012-11-29 1:54 ` Dave Chinner
2012-11-29 4:18 ` Dave Chinner
2012-11-29 4:26 ` [PATCH 2/4 V2] " Dave Chinner
2012-11-29 18:19 ` Andrew Dahl
2012-11-30 16:07 ` Christoph Hellwig
2012-11-28 2:01 ` Dave Chinner [this message]
2012-11-28 13:28 ` [PATCH 3/4] xfs: fix stray dquot unlock when reclaiming dquots Christoph Hellwig
2012-11-28 2:01 ` [PATCH 4/4] xfs: fix sparse reported log CRC endian issue Dave Chinner
2012-11-28 13:30 ` Christoph Hellwig
2012-11-28 21:31 ` Dave Chinner
2012-11-29 20:32 ` Ben Myers
2012-11-30 16:03 ` Christoph Hellwig
2012-11-30 16:04 ` Ben Myers
2012-12-03 18:18 ` Ben Myers
2012-11-29 22:29 ` Mark Tinguely
2012-11-29 21:22 ` [PATCH 0/4] xfs: patch queue for 3.8 Ben Myers
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=1354068063-1692-4-git-send-email-david@fromorbit.com \
--to=david@fromorbit.com \
--cc=xfs@oss.sgi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.