aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2011-01-25 04:06:19 -0500
committerAlex Elder <aelder@sgi.com>2011-02-07 14:29:06 -0500
commit04e99455ea5bb17ea7c2e7bb0970168efb736242 (patch)
tree6990228f08cf4ffdfe454bd3d4e88f42b23f9cf8 /fs/xfs/xfs_bmap.c
parent24446fc66fdebbdd8baca0f44fd2a47ad77ba580 (diff)
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>
Diffstat (limited to 'fs/xfs/xfs_bmap.c')
-rw-r--r--fs/xfs/xfs_bmap.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index dc3afd7739ff..2f89af25996f 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -2333,6 +2333,7 @@ xfs_bmap_rtalloc(
2333 xfs_extlen_t prod = 0; /* product factor for allocators */ 2333 xfs_extlen_t prod = 0; /* product factor for allocators */
2334 xfs_extlen_t ralen = 0; /* realtime allocation length */ 2334 xfs_extlen_t ralen = 0; /* realtime allocation length */
2335 xfs_extlen_t align; /* minimum allocation alignment */ 2335 xfs_extlen_t align; /* minimum allocation alignment */
2336 xfs_inode_t *ip; /* bitmap incore inode */
2336 xfs_rtblock_t rtb; 2337 xfs_rtblock_t rtb;
2337 2338
2338 mp = ap->ip->i_mount; 2339 mp = ap->ip->i_mount;
@@ -2365,6 +2366,16 @@ xfs_bmap_rtalloc(
2365 */ 2366 */
2366 if (ralen * mp->m_sb.sb_rextsize >= MAXEXTLEN) 2367 if (ralen * mp->m_sb.sb_rextsize >= MAXEXTLEN)
2367 ralen = MAXEXTLEN / mp->m_sb.sb_rextsize; 2368 ralen = MAXEXTLEN / mp->m_sb.sb_rextsize;
2369
2370 /*
2371 * Lock out other modifications to the RT bitmap inode.
2372 */
2373 error = xfs_trans_iget(mp, ap->tp, mp->m_sb.sb_rbmino, 0,
2374 XFS_ILOCK_EXCL, &ip);
2375 if (error)
2376 return error;
2377 ASSERT(ip == mp->m_rbmip);
2378
2368 /* 2379 /*
2369 * If it's an allocation to an empty file at offset 0, 2380 * If it's an allocation to an empty file at offset 0,
2370 * pick an extent that will space things out in the rt area. 2381 * pick an extent that will space things out in the rt area.