]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: check reflink allocation mappings
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 26 Jan 2018 19:37:44 +0000 (11:37 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Mon, 29 Jan 2018 15:27:24 +0000 (07:27 -0800)
commit71fc3e015e9f7c1582485890ef208fedb50ed9d5
tree80049ab307da5731a666d363a68ff14232ae0c70
parenta6183edab73ee05956f49b91484466de6c074888
xfs: check reflink allocation mappings

There's a really bad bug in xfs_reflink_allocate_cow -- if bmapi_write
can return a zero error code but no mappings.  This happens if there's
an extent size hint (which causes allocation requests to be rounded to
extsz granularity internally), but there wasn't a big enough chunk of
free space to start filling at the extsz granularity and fill even one
block of the range that we actually requested.

In any case, if we got no mappings we can't possibly do anything useful
with the contents of imap, so we must bail out with ENOSPC here.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/xfs_reflink.c