Skip to content

Commit bfca876

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
xfs: move q_qlock locking into xchk_quota_item
This avoids a pointless roundtrip because ilock needs to be taken first. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
1 parent a536bf9 commit bfca876

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

fs/xfs/scrub/quota.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,7 @@ xchk_quota_item(
155155
* We want to validate the bmap record for the storage backing this
156156
* dquot, so we need to lock the dquot and the quota file. For quota
157157
* operations, the locking order is first the ILOCK and then the dquot.
158-
* However, dqiterate gave us a locked dquot, so drop the dquot lock to
159-
* get the ILOCK.
160158
*/
161-
mutex_unlock(&dq->q_qlock);
162159
xchk_ilock(sc, XFS_ILOCK_SHARED);
163160
mutex_lock(&dq->q_qlock);
164161

@@ -251,6 +248,7 @@ xchk_quota_item(
251248
xchk_quota_item_timer(sc, offset, &dq->q_rtb);
252249

253250
out:
251+
mutex_unlock(&dq->q_qlock);
254252
if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
255253
return -ECANCELED;
256254

@@ -329,9 +327,7 @@ xchk_quota(
329327
/* Now look for things that the quota verifiers won't complain about. */
330328
xchk_dqiter_init(&cursor, sc, dqtype);
331329
while ((error = xchk_dquot_iter(&cursor, &dq)) == 1) {
332-
mutex_lock(&dq->q_qlock);
333330
error = xchk_quota_item(&sqi, dq);
334-
mutex_unlock(&dq->q_qlock);
335331
xfs_qm_dqrele(dq);
336332
if (error)
337333
break;

0 commit comments

Comments
 (0)