[CRIU] [PATCH] log: don't kill task, if unable to write pidfile

Ruslan Kuprieiev kupruser at gmail.com
Sat Nov 2 17:45:18 PDT 2013


write_pidfile() was taken out from cr-restore.c, where it was supposed to kill
child if unable to create pidfile. Now we're also using it at service/page-server where kill is redundant. So lets take out kill() from write_pidfile() back to cr-restore.

Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
---
 cr-restore.c | 10 ++++++++--
 log.c        |  1 -
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/cr-restore.c b/cr-restore.c
index 6e4c021..8e0d088 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -966,9 +966,15 @@ static inline int fork_with_pid(struct pstree_item *item)
 		item->pid.real = ret;
 
 	if (opts.pidfile && root_item == item) {
-		ret = write_pidfile(opts.pidfile, ret);
-		if (ret < 0)
+		int pid;
+
+		pid = ret;
+
+		ret = write_pidfile(opts.pidfile, pid);
+		if (ret < 0) {
 			pr_perror("Can't write pidfile");
+			kill(pid, SIGKILL);
+		}
 	}
 
 err_unlock:
diff --git a/log.c b/log.c
index 6fbf422..d009ede 100644
--- a/log.c
+++ b/log.c
@@ -201,7 +201,6 @@ int write_pidfile(char *pfname, int pid)
 	fd = openat(dfd, pfname, O_WRONLY | O_TRUNC | O_CREAT, 0600);
 	if (fd == -1) {
 		pr_perror("Can't open %s", pfname);
-		kill(pid, SIGKILL);
 		return -1;
 	}
 
-- 
1.8.1.2



More information about the CRIU mailing list