xfs: fix mmap_sem/iolock inversion in xfs_free_eofblocks
authorChristoph Hellwig <hch@infradead.org>
Thu, 11 Mar 2010 22:42:00 +0000 (09:42 +1100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 26 Apr 2010 14:41:14 +0000 (07:41 -0700)
commitb1d0040c6ec4b45cdcf5a4d788c50e58b7c0b20e
tree27e5281ca1a1a9455639bb0f653efaa676805294
parentf2a111377a25d43ce14212ed616e1e7f6bf31488
xfs: fix mmap_sem/iolock inversion in xfs_free_eofblocks

commit c56c9631cbe88f08854a56ff9776c1f310916830 upstream

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/xfs/xfs_rw.h
fs/xfs/xfs_vnodeops.c