xfs: fix mmap_sem/iolock inversion in xfs_free_eofblocks

When xfs_free_eofblocks is called from ->release the VM might already
hold the mmap_sem, but in the write path we take the iolock before
taking the mmap_sem in the generic write code.

Switch xfs_free_eofblocks to only trylock the iolock if called from
->release and skip trimming the prellocated blocks in that case.
We'll still free them later on the final iput.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
This commit is contained in:
Christoph Hellwig
2009-10-19 04:03:46 +00:00
committed by Alex Elder
parent 848ce8f731
commit c56c9631cb
2 changed files with 26 additions and 15 deletions

View File

@@ -36,13 +36,6 @@ xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb)
XFS_FSB_TO_DADDR((ip)->i_mount, (fsb)));
}
/*
* Flags for xfs_free_eofblocks
*/
#define XFS_FREE_EOF_LOCK (1<<0)
#define XFS_FREE_EOF_NOLOCK (1<<1)
/*
* helper function to extract extent size hint from inode
*/