mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-29 13:28:27 +00:00
page-xfer: page_server_get_pages: replace BUG_ONs with 'return -1'
Instead of crashing dump/page-server when a problem detected after the page-pipe was split, print nice error messages and return error. travis-ci: success for page-xfer: page_server_get_pages: replace BUG_ONs with 'return -1' (rev2) Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
836b1bc87a
commit
22b5d5e92d
@ -687,6 +687,31 @@ static int page_server_add(int sk, struct page_server_iov *pi, u32 flags)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool can_send_pages(struct page_pipe_buf *ppb, struct iovec *iov,
|
||||||
|
struct page_server_iov *pi)
|
||||||
|
{
|
||||||
|
unsigned long len = pi->nr_pages * PAGE_SIZE;
|
||||||
|
|
||||||
|
if (!(ppb->flags & PPB_LAZY)) {
|
||||||
|
pr_err("Requested pages are not lazy\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iov->iov_len != len) {
|
||||||
|
pr_err("IOV len %zu does not match requested %lu\n",
|
||||||
|
iov->iov_len, len);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pi->vaddr != encode_pointer(iov->iov_base)) {
|
||||||
|
pr_err("IOV start %p does not match requested addr %"PRIx64"\n",
|
||||||
|
iov->iov_base, pi->vaddr);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static int page_server_get_pages(int sk, struct page_server_iov *pi)
|
static int page_server_get_pages(int sk, struct page_server_iov *pi)
|
||||||
{
|
{
|
||||||
struct pstree_item *item;
|
struct pstree_item *item;
|
||||||
@ -711,9 +736,8 @@ static int page_server_get_pages(int sk, struct page_server_iov *pi)
|
|||||||
ppb = list_first_entry(&pp->bufs, struct page_pipe_buf, l);
|
ppb = list_first_entry(&pp->bufs, struct page_pipe_buf, l);
|
||||||
iov = &ppb->iov[0];
|
iov = &ppb->iov[0];
|
||||||
|
|
||||||
BUG_ON(!(ppb->flags & PPB_LAZY));
|
if (!can_send_pages(ppb, iov, pi))
|
||||||
BUG_ON(iov->iov_len != pi->nr_pages * PAGE_SIZE);
|
return -1;
|
||||||
BUG_ON(pi->vaddr != encode_pointer(iov->iov_base));
|
|
||||||
|
|
||||||
if (send_psi(sk, PS_IOV_ADD, pi->nr_pages, pi->vaddr, pi->dst_id))
|
if (send_psi(sk, PS_IOV_ADD, pi->nr_pages, pi->vaddr, pi->dst_id))
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user