Commit 56d563e9 authored by Ivan Shapovalov's avatar Ivan Shapovalov Committed by Pavel Emelyanov

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: 's avatarIvan Shapovalov <intelfx@intelfx.name>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent b2dfdb32
...@@ -995,33 +995,6 @@ long __export_restore_task(struct task_restore_args *args) ...@@ -995,33 +995,6 @@ long __export_restore_task(struct task_restore_args *args)
vma_entry->prot); 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 * Now when all VMAs are in their places time to set
* up AIO rings. * up AIO rings.
...@@ -1076,6 +1049,33 @@ long __export_restore_task(struct task_restore_args *args) ...@@ -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; ret = 0;
/* /*
......
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