Skip to contentSkip to conversation

xfs: don't iunlock the quota ip when quota block allocation fails

PATCH In review Darrick J. Wong 1 participant 2 messages Feb 22, 2018 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: don't iunlock the quota ip when quota block allocation fails

From: Darrick J. Wong <[email protected]>

In xfs_qm_dqalloc, we join the locked quota inode to the transaction we use to allocate blocks. If the allocation or mapping fails, we're not allowed to unlock the inode because the transaction code is in charge of unlocking it for us. Therefore, remove the iunlock call to avoid blowing asserts about unbalanced locking + mount hang.

Found by corrupting the AGF and allocating space in the filesystem (quotacheck) immediately after mount. The upcoming agfl wrapping fixup test will trigger this scenario.

---
 fs/xfs/xfs_dquot.c |    2 --
 1 file changed, 2 deletions(-)
fs/xfs/xfs_dquot.c +0 -2
index 43572f8..2410acc 100644
@@ -394,8 +394,6 @@ xfs_qm_dqalloc(
 error1:
 	xfs_defer_cancel(&dfops);
 error0:
-	xfs_iunlock(quotip, XFS_ILOCK_EXCL);
-
 	return error;
 }
 
#1 lore raw
Quoted 8 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

In xfs_qm_dqalloc, we join the locked quota inode to the transaction we use to allocate blocks. If the allocation or mapping fails, we're not allowed to unlock the inode because the transaction code is in charge of unlocking it for us. Therefore, remove the iunlock call to avoid blowing asserts about unbalanced locking + mount hang.

Quoted 5 lines

Found by corrupting the AGF and allocating space in the filesystem (quotacheck) immediately after mount. The upcoming agfl wrapping fixup test will trigger this scenario.

Realized I had a whole pile of other fixes to send out, so ignore this for now.

--D

Quoted 21 lines
---
 fs/xfs/xfs_dquot.c |    2 --
 1 file changed, 2 deletions(-)
fs/xfs/xfs_dquot.c +0 -3
index 43572f8..2410acc 100644
@@ -394,8 +394,6 @@ xfs_qm_dqalloc(
 error1:
 	xfs_defer_cancel(&dfops);
 error0:
-	xfs_iunlock(quotip, XFS_ILOCK_EXCL);
-
 	return error;
 }
 
--

To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html