COW allocated new extents, which are new part of the inode, So we
need to update the metadata.
Signed-off-by: Shiyang Ruan <ruansy.fnst(a)cn.fujitsu.com>
---
fs/xfs/xfs_iomap.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index a45b4e5a1d87..5c05c11e0cb2 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -1146,6 +1146,9 @@ xfs_file_iomap_end(
if ((flags & IOMAP_WRITE) && iomap->type == IOMAP_DELALLOC)
return xfs_file_iomap_end_delalloc(XFS_I(inode), offset,
length, written, iomap);
+ /* update the extent list after a COW operation */
+ if (iomap->flags & IOMAP_F_SHARED && iomap->src_addr)
+ return xfs_reflink_end_cow(XFS_I(inode), offset, length);
return 0;
}
--
2.17.0