xfs: handle racy AIO in xfs_reflink_end_cow
authorChristoph Hellwig <hch@lst.de>
Tue, 3 Oct 2017 15:58:33 +0000 (08:58 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Oct 2017 08:38:09 +0000 (10:38 +0200)
commit1b4998dceda7f2e8f397a9633fe288041b875050
treee19b766c1992515785f68c2315303f96751cdf9b
parent002295a6be81afc10dce31e72251a7215f9e28ee
xfs: handle racy AIO in xfs_reflink_end_cow

commit e12199f85d0ad1b04ce6c425ad93cd847fe930bb upstream.

If we got two AIO writes into a COW area the second one might not have any
COW extents left to convert.  Handle that case gracefully instead of
triggering an assert or accessing beyond the bounds of the extent list.

Signed-off-by: Christoph Hellwig <hch@lst.de>
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/xfs_reflink.c