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

files: Enlighten the rollback link-remap routine

When we don't do unlink no need to lookup for ns root-fd

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2015-09-18 11:41:00 +03:00
parent 85ebf0a83b
commit d7696a42b3

View File

@@ -459,12 +459,15 @@ static void __rollback_link_remaps(bool do_unlink)
return;
list_for_each_entry_safe(rlb, tmp, &link_remaps, list) {
mntns_root = mntns_get_root_fd(rlb->mnt_ns);
if (mntns_root < 0)
return;
if (do_unlink) {
mntns_root = mntns_get_root_fd(rlb->mnt_ns);
if (mntns_root >= 0)
unlinkat(mntns_root, rlb->path, 0);
else
pr_err("Failed to clenaup %s link remap\n", rlb->path);
}
list_del(&rlb->list);
if (do_unlink)
unlinkat(mntns_root, rlb->path, 0);
xfree(rlb->path);
xfree(rlb);
}