mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +00:00
pie: restore madvise flags after aio rings have been created
AIO rings internally are memory mappings, so they may have restorable madvise bits on them. Create the mappings before restoring their properties. Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
b2dfdb324f
commit
56d563e97d
@@ -995,33 +995,6 @@ long __export_restore_task(struct task_restore_args *args)
|
||||
vma_entry->prot);
|
||||
}
|
||||
|
||||
/*
|
||||
* Finally restore madivse() bits
|
||||
*/
|
||||
for (i = 0; i < args->vmas_n; i++) {
|
||||
unsigned long m;
|
||||
|
||||
vma_entry = args->vmas + i;
|
||||
if (!vma_entry->has_madv || !vma_entry->madv)
|
||||
continue;
|
||||
|
||||
for (m = 0; m < sizeof(vma_entry->madv) * 8; m++) {
|
||||
if (vma_entry->madv & (1ul << m)) {
|
||||
ret = sys_madvise(vma_entry->start,
|
||||
vma_entry_len(vma_entry),
|
||||
m);
|
||||
if (ret) {
|
||||
pr_err("madvise(%"PRIx64", %"PRIu64", %ld) "
|
||||
"failed with %ld\n",
|
||||
vma_entry->start,
|
||||
vma_entry_len(vma_entry),
|
||||
m, ret);
|
||||
goto core_restore_end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Now when all VMAs are in their places time to set
|
||||
* up AIO rings.
|
||||
@@ -1076,6 +1049,33 @@ long __export_restore_task(struct task_restore_args *args)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Finally restore madivse() bits
|
||||
*/
|
||||
for (i = 0; i < args->vmas_n; i++) {
|
||||
unsigned long m;
|
||||
|
||||
vma_entry = args->vmas + i;
|
||||
if (!vma_entry->has_madv || !vma_entry->madv)
|
||||
continue;
|
||||
|
||||
for (m = 0; m < sizeof(vma_entry->madv) * 8; m++) {
|
||||
if (vma_entry->madv & (1ul << m)) {
|
||||
ret = sys_madvise(vma_entry->start,
|
||||
vma_entry_len(vma_entry),
|
||||
m);
|
||||
if (ret) {
|
||||
pr_err("madvise(%"PRIx64", %"PRIu64", %ld) "
|
||||
"failed with %ld\n",
|
||||
vma_entry->start,
|
||||
vma_entry_len(vma_entry),
|
||||
m, ret);
|
||||
goto core_restore_end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user