[CRIU] [PATCH] files: Enlighten the rollback link-remap routine

Pavel Emelyanov xemul at parallels.com
Fri Sep 18 01:41:45 PDT 2015


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

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>

---

diff --git a/files-reg.c b/files-reg.c
index f3ba898..c8e30a8 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -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);
 	}


More information about the CRIU mailing list