Commit 6a17d8cf authored by Mike Rapoport's avatar Mike Rapoport Committed by Andrei Vagin

check/servise: use cached kdat values for features check

The kerndat_init() is now called before the jump to action handler. This
allows us to directly use kdat without calling to the corresponding
kerndat_*() methods.

✓ travis-ci: success for lazy-pages: update checks for availability of userfaultfd (rev3)
Signed-off-by: 's avatarMike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 8d80012b
...@@ -676,9 +676,6 @@ static int check_ptrace_dump_seccomp_filters(void) ...@@ -676,9 +676,6 @@ static int check_ptrace_dump_seccomp_filters(void)
static int check_mem_dirty_track(void) static int check_mem_dirty_track(void)
{ {
if (kerndat_get_dirty_track() < 0)
return -1;
if (!kdat.has_dirty_track) { if (!kdat.has_dirty_track) {
pr_warn("Dirty tracking is OFF. Memory snapshot will not work.\n"); pr_warn("Dirty tracking is OFF. Memory snapshot will not work.\n");
return -1; return -1;
...@@ -772,9 +769,6 @@ static int check_aio_remap(void) ...@@ -772,9 +769,6 @@ static int check_aio_remap(void)
static int check_fdinfo_lock(void) static int check_fdinfo_lock(void)
{ {
if (kerndat_fdinfo_has_lock())
return -1;
if (!kdat.has_fdinfo_lock) { if (!kdat.has_fdinfo_lock) {
pr_err("fdinfo doesn't contain the lock field\n"); pr_err("fdinfo doesn't contain the lock field\n");
return -1; return -1;
...@@ -931,12 +925,6 @@ out: ...@@ -931,12 +925,6 @@ out:
static int check_tcp_halt_closed(void) static int check_tcp_halt_closed(void)
{ {
int ret;
ret = kerndat_tcp_repair();
if (ret < 0)
return -1;
if (!kdat.has_tcp_half_closed) { if (!kdat.has_tcp_half_closed) {
pr_err("TCP_REPAIR can't be enabled for half-closed sockets\n"); pr_err("TCP_REPAIR can't be enabled for half-closed sockets\n");
return -1; return -1;
...@@ -1023,9 +1011,6 @@ static int check_userns(void) ...@@ -1023,9 +1011,6 @@ static int check_userns(void)
static int check_loginuid(void) static int check_loginuid(void)
{ {
if (kerndat_loginuid() < 0)
return -1;
if (kdat.luid != LUID_FULL) { if (kdat.luid != LUID_FULL) {
pr_warn("Loginuid restore is OFF.\n"); pr_warn("Loginuid restore is OFF.\n");
return -1; return -1;
...@@ -1048,9 +1033,6 @@ static int check_compat_cr(void) ...@@ -1048,9 +1033,6 @@ static int check_compat_cr(void)
static int check_uffd(void) static int check_uffd(void)
{ {
if (kerndat_uffd())
return -1;
if (!kdat.has_uffd) { if (!kdat.has_uffd) {
pr_err("UFFD is not supported\n"); pr_err("UFFD is not supported\n");
return -1; return -1;
......
...@@ -886,22 +886,11 @@ static int handle_feature_check(int sk, CriuReq * msg) ...@@ -886,22 +886,11 @@ static int handle_feature_check(int sk, CriuReq * msg)
setproctitle("feature-check --rpc"); setproctitle("feature-check --rpc");
if ((msg->features->has_mem_track == 1) && if ((msg->features->has_mem_track == 1) &&
(msg->features->mem_track == true)) { (msg->features->mem_track == true))
feat.mem_track = kdat.has_dirty_track;
feat.mem_track = true;
ret = kerndat_get_dirty_track();
if (ret)
feat.mem_track = false;
if (!kdat.has_dirty_track)
feat.mem_track = false;
}
if ((msg->features->has_lazy_pages == 1) && if ((msg->features->has_lazy_pages == 1) &&
(msg->features->lazy_pages == true)) { (msg->features->lazy_pages == true))
ret = kerndat_uffd();
/* /*
* Not checking for specific UFFD features yet. * Not checking for specific UFFD features yet.
* If no error is returned it is probably * If no error is returned it is probably
...@@ -909,11 +898,7 @@ static int handle_feature_check(int sk, CriuReq * msg) ...@@ -909,11 +898,7 @@ static int handle_feature_check(int sk, CriuReq * msg)
* be extended in the future for a more detailed * be extended in the future for a more detailed
* UFFD feature check. * UFFD feature check.
*/ */
if (ret || !kdat.has_uffd) feat.lazy_pages = kdat.has_uffd;
feat.lazy_pages = false;
else
feat.lazy_pages = true;
}
resp.features = &feat; resp.features = &feat;
resp.type = msg->type; resp.type = msg->type;
......
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