Commit 8bfce926 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

criu: pagemap-cache -- Fix map filling in greedy mode

Reported-by: 's avatarAndrew Vagin <avagin@openvz.org>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Acked-by: 's avatarAndrew Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 5241757b
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "util.h" #include "util.h"
#include "log.h" #include "log.h"
#include "vma.h" #include "vma.h"
#include "mem.h"
#include "kerndat.h" #include "kerndat.h"
#undef LOG_PREFIX #undef LOG_PREFIX
...@@ -131,12 +132,16 @@ static int pmc_fill_cache(pmc_t *pmc, const struct vma_area *vma) ...@@ -131,12 +132,16 @@ static int pmc_fill_cache(pmc_t *pmc, const struct vma_area *vma)
BUG_ON(pmc->map_len < size_map); BUG_ON(pmc->map_len < size_map);
if (unlikely(pmc->fd < 0)) { if (unlikely(pmc->fd < 0)) {
u64 pme = PME_PRESENT;
size_t i;
/* /*
* We don't have access to the dumpee pagemap so fill * We don't have access to the dumpee pagemap so fill
* everything as present. It's better than refuse * everything as present. It's better than refuse
* to dump because it simply disables optimisation. * to dump because it simply disables optimisation.
*/ */
memset(pmc->map, 1, size_map); for (i = 0; i < (size_map / sizeof(pme)); i++)
pmc->map[i] = pme;
} else { } else {
if (pread(pmc->fd, pmc->map, size_map, PAGEMAP_PFN_OFF(pmc->start)) != size_map) { if (pread(pmc->fd, pmc->map, size_map, PAGEMAP_PFN_OFF(pmc->start)) != size_map) {
pmc_zap(pmc); pmc_zap(pmc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment