diff options
author | Kamal Dasu <kdasu.kdev@gmail.com> | 2012-02-22 19:41:39 -0500 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-03-22 16:31:06 -0400 |
commit | 5575acc7807595687288b3bbac15103f2a5462e1 (patch) | |
tree | 1a47a34756e1c0023e2df8f3b1d9e10de568601a /fs/xfs/xfs_bmap.c | |
parent | 1c2ccc66bcef992bec7bad6d52cade66d632d7fb (diff) |
xfs: fix deadlock in xfs_rtfree_extent
To fix the deadlock caused by repeatedly calling xfs_rtfree_extent
- removed xfs_ilock() and xfs_trans_ijoin() from xfs_rtfree_extent(),
instead added asserts that the inode is locked and has an inode_item
attached to it.
- in xfs_bunmapi() when dealing with an inode with the rt flag
call xfs_ilock() and xfs_trans_ijoin() so that the
reference count is bumped on the inode and attached it to the
transaction before calling into xfs_bmap_del_extent, similar to
what we do in xfs_bmap_rtalloc.
Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
Reviewed-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_bmap.c')
-rw-r--r-- | fs/xfs/xfs_bmap.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index 3548c6f7559..85e7e327bcd 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
@@ -5124,6 +5124,15 @@ xfs_bunmapi( | |||
5124 | cur->bc_private.b.flags = 0; | 5124 | cur->bc_private.b.flags = 0; |
5125 | } else | 5125 | } else |
5126 | cur = NULL; | 5126 | cur = NULL; |
5127 | |||
5128 | if (isrt) { | ||
5129 | /* | ||
5130 | * Synchronize by locking the bitmap inode. | ||
5131 | */ | ||
5132 | xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL); | ||
5133 | xfs_trans_ijoin(tp, mp->m_rbmip, XFS_ILOCK_EXCL); | ||
5134 | } | ||
5135 | |||
5127 | extno = 0; | 5136 | extno = 0; |
5128 | while (bno != (xfs_fileoff_t)-1 && bno >= start && lastx >= 0 && | 5137 | while (bno != (xfs_fileoff_t)-1 && bno >= start && lastx >= 0 && |
5129 | (nexts == 0 || extno < nexts)) { | 5138 | (nexts == 0 || extno < nexts)) { |