From 08648cf0da381fb667fa413ba95407ae4c3f8a8f Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Fri, 24 May 2024 18:45:09 -0700 Subject: [PATCH] Allow block cloning to be interrupted by a signal. Even though block cloning is much faster than regular copying, it is not instantaneous - the file might be large and the recordsize small. It would be nice to be able to interrupt it with a signal (e.g., SIGINFO on FreeBSD to see the progress). Reviewed-by: Brian Behlendorf Signed-off-by: Pawel Jakub Dawidek Closes #16208 --- module/zfs/zfs_vnops.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index babb07ca25..b222a6f88d 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -1412,6 +1412,11 @@ zfs_clone_range(znode_t *inzp, uint64_t *inoffp, znode_t *outzp, outoff += size; len -= size; done += size; + + if (issig(JUSTLOOKING) && issig(FORREAL)) { + error = SET_ERROR(EINTR); + break; + } } vmem_free(bps, sizeof (bps[0]) * maxblocks);