[CRIU] [PATCH v3 3/5] lazy-pages: make ud_open return int
Mike Rapoport
mike.rapoport at gmail.com
Wed Nov 2 16:01:46 PDT 2016
To properly handle zombie processes we will need to distinguish failures
coming from socket communications from absent userfault file descriptor
Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---
criu/uffd.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/criu/uffd.c b/criu/uffd.c
index 3d0a446..d9668d8 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -312,7 +312,7 @@ out:
static int find_vmas(struct lazy_pages_info *lpi);
-static struct lazy_pages_info *ud_open(int client)
+static int ud_open(int client, struct lazy_pages_info **_lpi)
{
struct lazy_pages_info *lpi;
int ret = -1;
@@ -350,12 +350,13 @@ static struct lazy_pages_info *ud_open(int client)
goto out;
hlist_add_head(&lpi->hash, &lpi_hash[lpi->uffd % LPI_HASH_SIZE]);
+ *_lpi = lpi;
- return lpi;
+ return 0;
out:
lpi_fini(lpi);
- return NULL;
+ return -1;
}
static int get_page(struct lazy_pages_info *lpi, unsigned long addr, void *dest)
@@ -862,9 +863,8 @@ static int prepare_uffds(int epollfd)
pr_debug("client fd %d\n", client);
for (i = 0; i < task_entries->nr_tasks; i++) {
- struct lazy_pages_info *lpi;
- lpi = ud_open(client);
- if (!lpi)
+ struct lazy_pages_info *lpi = NULL;
+ if (ud_open(client, &lpi))
goto close_uffd;
if (epoll_add_fd(epollfd, lpi->uffd))
goto close_uffd;
--
1.9.1
More information about the CRIU
mailing list