]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Make vn_generic_copy_file_range() interruptible via a signal.
authorRick Macklem <rmacklem@FreeBSD.org>
Fri, 9 Oct 2020 01:04:28 +0000 (01:04 +0000)
committerRick Macklem <rmacklem@FreeBSD.org>
Fri, 9 Oct 2020 01:04:28 +0000 (01:04 +0000)
commit19fe23fa2bd52d6a42fb408d21b9d49c4bee81ef
treec032a2f9ac80dd58429470899df971b525b229bf
parenta21d9b36a1c41c4a7c53f4d89c7d7d98edb0ae7e
Make vn_generic_copy_file_range() interruptible via a signal.

Without this patch, when vn_generic_copy_file_range() is
doing a large copy, it will remain in the function for a
considerable amount of time, delaying handling of any
outstanding signals until the copy completes.

This patch adds checks for signals that need to be
processed after each successful data copy cycle.
When sig_intr() returns non-zero, vn_generic_copy_file_range()
will return.
The check "if (len < savlen)" ensures that some data
has been copied, so that progress will be made.

Note that, since copy_file_range(2) is allowed to
return fewer bytes copied than requested, it
will never return EINTR/ERESTART when sig_intr()
returns non-zero.

Reviewed by: kib, asomers
Differential Revision: https://reviews.freebsd.org/D26620
sys/kern/vfs_vnops.c