xfs: only lock the rt bitmap inode once per allocation
Currently both xfs_rtpick_extent and xfs_rtallocate_extent call xfs_trans_iget to grab and lock the rt bitmap inode, which results in a deadlock since the removal of the lock recursion counters in commit "xfs: simplify inode to transaction joining" Fix this by acquiring and locking the inode in xfs_bmap_rtalloc before calling into xfs_rtpick_extent and xfs_rtallocate_extent. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
This commit is contained in:

committed by
Alex Elder

parent
24446fc66f
commit
04e99455ea
@@ -2333,6 +2333,7 @@ xfs_bmap_rtalloc(
|
||||
xfs_extlen_t prod = 0; /* product factor for allocators */
|
||||
xfs_extlen_t ralen = 0; /* realtime allocation length */
|
||||
xfs_extlen_t align; /* minimum allocation alignment */
|
||||
xfs_inode_t *ip; /* bitmap incore inode */
|
||||
xfs_rtblock_t rtb;
|
||||
|
||||
mp = ap->ip->i_mount;
|
||||
@@ -2365,6 +2366,16 @@ xfs_bmap_rtalloc(
|
||||
*/
|
||||
if (ralen * mp->m_sb.sb_rextsize >= MAXEXTLEN)
|
||||
ralen = MAXEXTLEN / mp->m_sb.sb_rextsize;
|
||||
|
||||
/*
|
||||
* Lock out other modifications to the RT bitmap inode.
|
||||
*/
|
||||
error = xfs_trans_iget(mp, ap->tp, mp->m_sb.sb_rbmino, 0,
|
||||
XFS_ILOCK_EXCL, &ip);
|
||||
if (error)
|
||||
return error;
|
||||
ASSERT(ip == mp->m_rbmip);
|
||||
|
||||
/*
|
||||
* If it's an allocation to an empty file at offset 0,
|
||||
* pick an extent that will space things out in the rt area.
|
||||
|
Reference in New Issue
Block a user