2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 09:58:09 +00:00

kcmp: Fix ret code comparison

In the early draft of kcmp syscall it has been returning
[-1|0|1] values but finally [0|1|2] were merged into the
kernel, but I forgot to update the criu code. The good
thing is that because we're using rbtree the kcmp results
are still sorted and tree is balanced but sometime we may
take a wrong branch generating new ID even if the object
is present in the tree which eventually may lead to dump
faulure.

Reported-by: Deyan Doychev <deyan@1h.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Cyrill Gorcunov 2014-04-22 00:33:29 +04:00 committed by Pavel Emelyanov
parent 85569e8dd4
commit 443adb5a45

View File

@ -149,12 +149,18 @@ static u32 kid_generate_sub(struct kid_tree *tree, struct kid_entry *e,
this->elem.idx, elem->idx); this->elem.idx, elem->idx);
parent = *new; parent = *new;
if (ret < 0) if (ret == 1)
node = node->rb_left, new = &((*new)->rb_left); node = node->rb_left, new = &((*new)->rb_left);
else if (ret > 0) else if (ret == 2)
node = node->rb_right, new = &((*new)->rb_right); node = node->rb_right, new = &((*new)->rb_right);
else else if (ret == 0)
return this->subid; return this->subid;
else {
pr_err("kcmp failed: pid (%d %d) type %u idx (%u %u) ret %d\n",
this->elem.pid, elem->pid, tree->kcmp_type,
this->elem.idx, elem->idx, ret);
return 0;
}
} }
sub = alloc_kid_entry(tree, elem); sub = alloc_kid_entry(tree, elem);