[PATCH 1/2] xfs: fix swapext ilock deadlock

Christoph Hellwig hch at infradead.org
Thu Jul 31 12:15:00 CDT 2014


On Thu, Jul 31, 2014 at 04:12:07PM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner at redhat.com>
> 
> xfs_swap_extents() holds the ilock over a call to
> filemap_write_and_wait(), which can then try to write data and take
> the ilock. That causes a self-deadlock.
> 
> Fix the deadlock and clean up the code by separating the locking
> appropriately. Add a lockflags variable to track what locks we are
> holding as we gain and drop them and cleanup the error handling to
> always use "out_unlock" with the lockflags variable.
> 
> Signed-off-by: Dave Chinner <dchinner at redhat.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch at lst.de>



More information about the xfs mailing list