Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

xfs: scrub: unlock dquot before early return in quota scrub

xchk_quota_item can return early after calling xchk_fblock_process_error.
When that helper returns false, the function returned immediately without
dropping dq->q_qlock, which can leave the dquot lock held and risk lock
leaks or deadlocks in later quota operations.

Fix this by unlocking dq->q_qlock before the early return.

Signed-off-by: hongao <hongao@uniontech.com>
Fixes: 7d1f0e167a067e ("xfs: check the ondisk space mapping behind a dquot")
Cc: <stable@vger.kernel.org> # v6.8
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>

authored by

hongao and committed by
Carlos Maiolino
268378b6 7cac6094

+3 -1
+3 -1
fs/xfs/scrub/quota.c
··· 171 171 172 172 error = xchk_quota_item_bmap(sc, dq, offset); 173 173 xchk_iunlock(sc, XFS_ILOCK_SHARED); 174 - if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, offset, &error)) 174 + if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, offset, &error)) { 175 + mutex_unlock(&dq->q_qlock); 175 176 return error; 177 + } 176 178 177 179 /* 178 180 * Warn if the hard limits are larger than the fs.