From 1f2cc31fd5d2eef89bb570b2789b09fc3186c218 Mon Sep 17 00:00:00 2001 From: Mike Rapoport Date: Mon, 14 Aug 2017 16:50:00 +0300 Subject: [PATCH] lazy-pages: treat ESRCH returned by uffdio_copy as process exit condition Newer kernels will report ESRCH when uffdio_copy is attempted when the process is exiting [1]. We take care of the new errno value and keep ENOSPC for compatibility. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/fs/userfaultfd.c?id=e86b298bebf7e799e4b7232e9135799f1947552e Signed-off-by: Mike Rapoport Signed-off-by: Pavel Emelyanov --- criu/uffd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/criu/uffd.c b/criu/uffd.c index ab7c028d1..c5ad78503 100644 --- a/criu/uffd.c +++ b/criu/uffd.c @@ -688,7 +688,7 @@ static int uffd_copy(struct lazy_pages_info *lpi, __u64 address, int nr_pages) lp_debug(lpi, "uffd_copy: 0x%llx/%ld\n", uffdio_copy.dst, len); rc = ioctl(lpi->lpfd.fd, UFFDIO_COPY, &uffdio_copy); if (rc) { - if (errno == ENOSPC) { + if (errno == ENOSPC || errno == ESRCH) { handle_exit(lpi); return 0; }