summaryrefslogtreecommitdiff
path: root/fs/xfs/quota/xfs_dquot.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2009-01-19 02:03:25 +0100
committerChristoph Hellwig <hch@brick.lst.de>2009-01-19 02:03:25 +0100
commit98b8c7a0c42acf0d6963dbb9aabe4a2e312aae12 (patch)
tree0187d4acd07f7631a300257c0da93e81409d56ef /fs/xfs/quota/xfs_dquot.c
parent5bb87a33b2cfb8e7ef3383718274094bdff266a3 (diff)
downloadlwn-98b8c7a0c42acf0d6963dbb9aabe4a2e312aae12.tar.gz
lwn-98b8c7a0c42acf0d6963dbb9aabe4a2e312aae12.zip
xfs: add a lock class for group/project dquots
We can have both a user and a group/project dquot locked at the same time, as long as the user dquot is locked first. Tell lockdep about that fact by making the group/project dquots a different lock class. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/quota/xfs_dquot.c')
-rw-r--r--fs/xfs/quota/xfs_dquot.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c
index ebdf3c842dce..6543c0b29753 100644
--- a/fs/xfs/quota/xfs_dquot.c
+++ b/fs/xfs/quota/xfs_dquot.c
@@ -73,6 +73,8 @@ int xfs_dqreq_num;
int xfs_dqerror_mod = 33;
#endif
+static struct lock_class_key xfs_dquot_other_class;
+
/*
* Allocate and initialize a dquot. We don't always allocate fresh memory;
* we try to reclaim a free dquot if the number of incore dquots are above
@@ -139,7 +141,15 @@ xfs_qm_dqinit(
ASSERT(dqp->q_trace);
xfs_dqtrace_entry(dqp, "DQRECLAIMED_INIT");
#endif
- }
+ }
+
+ /*
+ * In either case we need to make sure group quotas have a different
+ * lock class than user quotas, to make sure lockdep knows we can
+ * locks of one of each at the same time.
+ */
+ if (!(type & XFS_DQ_USER))
+ lockdep_set_class(&dqp->q_qlock, &xfs_dquot_other_class);
/*
* log item gets initialized later