[CRIU] [PATCH v4 6/9] mount: fix mnt_resort_siblings to work as described
Pavel Tikhomirov
ptikhomirov at virtuozzo.com
Mon Dec 11 19:07:23 MSK 2017
We should add new entry _before_ first entry with less depth to sort in
descending order.
e.g: entries in list have depths [7,5,3], adding new entry m with depth
4 we would break list_for_each_entry loop on p with depth 3, before
patch we would get [7,5,3,4] after list_add, which is wrong.
Also we can relax "<=" check to "<" to avoid unnecessary reordering.
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
criu/mount.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/criu/mount.c b/criu/mount.c
index 82c1dfeef..20c9af86e 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -447,10 +447,10 @@ static void mnt_resort_siblings(struct mount_info *tree)
depth = mnt_depth(m);
list_for_each_entry(p, &list, siblings)
- if (mnt_depth(p) <= depth)
+ if (mnt_depth(p) < depth)
break;
- list_add(&m->siblings, &p->siblings);
+ list_add_tail(&m->siblings, &p->siblings);
mnt_resort_siblings(m);
}
--
2.14.3
More information about the CRIU
mailing list