mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-31 22:10:38 +00:00
lazy-pages: explicitly set process exited condition
Instead of relying on length of various lists add a boolean variable to lazy_pages_info to make it clean when the process has exited Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
6a66b87e12
commit
6115934bce
1 changed files with 10 additions and 8 deletions
18
criu/uffd.c
18
criu/uffd.c
|
|
@ -78,6 +78,7 @@ struct lp_req {
|
|||
|
||||
struct lazy_pages_info {
|
||||
int pid;
|
||||
bool exited;
|
||||
|
||||
struct list_head iovs;
|
||||
struct list_head reqs;
|
||||
|
|
@ -709,6 +710,7 @@ static int handle_exit(struct lazy_pages_info *lpi)
|
|||
free_iovs(lpi);
|
||||
close(lpi->lpfd.fd);
|
||||
lpi->lpfd.fd = 0;
|
||||
lpi->exited = true;
|
||||
|
||||
/* keep it for tracking in-flight requests and for the summary */
|
||||
list_move_tail(&lpi->l, &lpis);
|
||||
|
|
@ -767,6 +769,14 @@ static int uffd_io_complete(struct page_read *pr, unsigned long img_addr, int nr
|
|||
|
||||
lpi = container_of(pr, struct lazy_pages_info, pr);
|
||||
|
||||
/*
|
||||
* The process may exit while we still have requests in
|
||||
* flight. We just drop the request and the received data in
|
||||
* this case to avoid making uffd unhappy
|
||||
*/
|
||||
if (lpi->exited)
|
||||
return 0;
|
||||
|
||||
list_for_each_entry(req, &lpi->reqs, l) {
|
||||
if (req->img_addr == img_addr) {
|
||||
addr = req->addr;
|
||||
|
|
@ -776,14 +786,6 @@ static int uffd_io_complete(struct page_read *pr, unsigned long img_addr, int nr
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The process may exit while we still have requests in
|
||||
* flight. We just drop the request and the received data in
|
||||
* this case to avoid making uffd unhappy
|
||||
*/
|
||||
if (list_empty(&lpi->iovs))
|
||||
return 0;
|
||||
|
||||
BUG_ON(!addr);
|
||||
|
||||
if (uffd_copy(lpi, addr, nr))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue