xfs: fix multi-AG deadlock in xfs_bunmapi
authorChristoph Hellwig <hch@lst.de>
Sun, 17 Sep 2017 21:06:40 +0000 (14:06 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Sep 2017 06:19:59 +0000 (08:19 +0200)
commit229980158f95098ba82e7bec91ce8ada18335bdc
treeb481d6cd30fc85b9eb9c7a9055781fa92b2bacde
parent81e27c94f9ab86c04ba4ca5f1d2bcf9e61f7b5af
xfs: fix multi-AG deadlock in xfs_bunmapi

commit 5b094d6dac0451ad89b1dc088395c7b399b7e9e8 upstream.

Just like in the allocator we must avoid touching multiple AGs out of
order when freeing blocks, as freeing still locks the AGF and can cause
the same AB-BA deadlocks as in the allocation path.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/libxfs/xfs_bmap.c