Skip to content

Commit 7dd30ac

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
xfs: move q_qlock locking into xqcheck_compare_dquot
Instead of having both callers do it. 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 bfca876 commit 7dd30ac

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

fs/xfs/scrub/quotacheck.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ xqcheck_compare_dquot(
563563
return -ECANCELED;
564564
}
565565

566+
mutex_lock(&dq->q_qlock);
566567
mutex_lock(&xqc->lock);
567568
error = xfarray_load_sparse(counts, dq->q_id, &xcdq);
568569
if (error)
@@ -589,18 +590,16 @@ xqcheck_compare_dquot(
589590
xchk_set_incomplete(xqc->sc);
590591
error = -ECANCELED;
591592
}
593+
out_unlock:
592594
mutex_unlock(&xqc->lock);
595+
mutex_unlock(&dq->q_qlock);
593596
if (error)
594597
return error;
595598

596599
if (xqc->sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
597600
return -ECANCELED;
598601

599602
return 0;
600-
601-
out_unlock:
602-
mutex_unlock(&xqc->lock);
603-
return error;
604603
}
605604

606605
/*
@@ -635,9 +634,7 @@ xqcheck_walk_observations(
635634
if (error)
636635
return error;
637636

638-
mutex_lock(&dq->q_qlock);
639637
error = xqcheck_compare_dquot(xqc, dqtype, dq);
640-
mutex_unlock(&dq->q_qlock);
641638
xfs_qm_dqrele(dq);
642639
if (error)
643640
return error;
@@ -675,9 +672,7 @@ xqcheck_compare_dqtype(
675672
/* Compare what we observed against the actual dquots. */
676673
xchk_dqiter_init(&cursor, sc, dqtype);
677674
while ((error = xchk_dquot_iter(&cursor, &dq)) == 1) {
678-
mutex_lock(&dq->q_qlock);
679675
error = xqcheck_compare_dquot(xqc, dqtype, dq);
680-
mutex_unlock(&dq->q_qlock);
681676
xfs_qm_dqrele(dq);
682677
if (error)
683678
break;

0 commit comments

Comments
 (0)