]> git.hungrycats.org Git - linux/commitdiff
iomap: don't bother unsharing delalloc extents
authorDarrick J. Wong <djwong@kernel.org>
Wed, 2 Oct 2024 15:00:40 +0000 (08:00 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Nov 2024 15:26:42 +0000 (16:26 +0100)
[ Upstream commit f7a4874d977bf4202ad575031222e78809a36292 ]

If unshare encounters a delalloc reservation in the srcmap, that means
that the file range isn't shared because delalloc reservations cannot be
reflinked.  Therefore, don't try to unshare them.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/20241002150040.GB21853@frogsfrogsfrogs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Stable-dep-of: 50793801fc7f ("fsdax: dax_unshare_iter needs to copy entire blocks")
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/iomap/buffered-io.c

index 527d3bcfc69a7f94097c28ee19474a56d26273c9..b1af9001e6db01432a2efe4f107a60e295024992 100644 (file)
@@ -1096,7 +1096,7 @@ static loff_t iomap_unshare_iter(struct iomap_iter *iter)
                return length;
 
        /*
-        * Don't bother with holes or unwritten extents.
+        * Don't bother with delalloc reservations, holes or unwritten extents.
         *
         * Note that we use srcmap directly instead of iomap_iter_srcmap as
         * unsharing requires providing a separate source map, and the presence
@@ -1105,6 +1105,7 @@ static loff_t iomap_unshare_iter(struct iomap_iter *iter)
         * fork for XFS.
         */
        if (iter->srcmap.type == IOMAP_HOLE ||
+           iter->srcmap.type == IOMAP_DELALLOC ||
            iter->srcmap.type == IOMAP_UNWRITTEN)
                return length;