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>
This commit is contained in:
parent
1c2ccc66bc
commit
5575acc780
|
@ -5124,6 +5124,15 @@ xfs_bunmapi(
|
||||||
cur->bc_private.b.flags = 0;
|
cur->bc_private.b.flags = 0;
|
||||||
} else
|
} else
|
||||||
cur = NULL;
|
cur = NULL;
|
||||||
|
|
||||||
|
if (isrt) {
|
||||||
|
/*
|
||||||
|
* Synchronize by locking the bitmap inode.
|
||||||
|
*/
|
||||||
|
xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL);
|
||||||
|
xfs_trans_ijoin(tp, mp->m_rbmip, XFS_ILOCK_EXCL);
|
||||||
|
}
|
||||||
|
|
||||||
extno = 0;
|
extno = 0;
|
||||||
while (bno != (xfs_fileoff_t)-1 && bno >= start && lastx >= 0 &&
|
while (bno != (xfs_fileoff_t)-1 && bno >= start && lastx >= 0 &&
|
||||||
(nexts == 0 || extno < nexts)) {
|
(nexts == 0 || extno < nexts)) {
|
||||||
|
|
|
@ -183,6 +183,7 @@ error_cancel:
|
||||||
oblocks = map.br_startoff + map.br_blockcount;
|
oblocks = map.br_startoff + map.br_blockcount;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -2139,11 +2140,9 @@ xfs_rtfree_extent(
|
||||||
xfs_buf_t *sumbp; /* summary file block buffer */
|
xfs_buf_t *sumbp; /* summary file block buffer */
|
||||||
|
|
||||||
mp = tp->t_mountp;
|
mp = tp->t_mountp;
|
||||||
/*
|
|
||||||
* Synchronize by locking the bitmap inode.
|
ASSERT(mp->m_rbmip->i_itemp != NULL);
|
||||||
*/
|
ASSERT(xfs_isilocked(mp->m_rbmip, XFS_ILOCK_EXCL));
|
||||||
xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL);
|
|
||||||
xfs_trans_ijoin(tp, mp->m_rbmip, XFS_ILOCK_EXCL);
|
|
||||||
|
|
||||||
#if defined(__KERNEL__) && defined(DEBUG)
|
#if defined(__KERNEL__) && defined(DEBUG)
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue