From ef527958c6a1fc07177636465194625ef8e64083 Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Wed, 17 Jan 2024 08:51:07 -0800 Subject: Fix cloning into mmaped and cached file. If the destination file is mmaped and the mmaped region was already read, so it is cached, we need to update mmaped pages after successful clone using update_pages(). Reviewed-by: Alexander Motin Reviewed-by: Brian Behlendorf Pointed out by: Ka Ho Ng Signed-off-by: Pawel Jakub Dawidek Closes #15772 --- module/zfs/zfs_vnops.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'module/zfs') diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index 812e42f64..aa61575a6 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -1355,6 +1355,10 @@ zfs_clone_range(znode_t *inzp, uint64_t *inoffp, znode_t *outzp, break; } + if (zn_has_cached_data(outzp, outoff, outoff + size - 1)) { + update_pages(outzp, outoff, size, outos); + } + zfs_clear_setid_bits_if_necessary(outzfsvfs, outzp, cr, &clear_setid_bits_txg, tx); -- cgit v1.2.3