From: Simon Schubert Date: Sat, 7 Mar 2009 16:35:02 +0000 (+0100) Subject: signals: stop all threads of a process before taking a checkpoint X-Git-Tag: v2.3.1~311 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/6acb4ed8e75e72485a7d174d6366a227b1879805 signals: stop all threads of a process before taking a checkpoint If we want to checkpoint a multi-threaded process, we need to wait until the process is in a quiescent state, otherwise our checkpoint might be incorrect. --- diff --git a/sys/kern/kern_checkpoint.c b/sys/kern/kern_checkpoint.c index 470cd5ac5a..38324643d7 100644 --- a/sys/kern/kern_checkpoint.c +++ b/sys/kern/kern_checkpoint.c @@ -693,7 +693,11 @@ ckpt_freeze_proc(struct lwp *lp, struct file *fp) PRINTF(("calling generic_elf_coredump\n")); limit = p->p_rlimit[RLIMIT_CORE].rlim_cur; if (limit) { + proc_stop(p); + while (p->p_nstopped < p->p_nthreads - 1) + tsleep(&p->p_nstopped, 0, "freeze", 1); error = generic_elf_coredump(lp, SIGCKPT, fp, limit); + proc_unstop(p); } else { error = ERANGE; }