[CRIU] [PATCH 05/13] parasite-syscall: Add parasite_[init|fini]_threads_seized helpers

Cyrill Gorcunov gorcunov at openvz.org
Wed Nov 7 05:20:49 EST 2012


On Wed, Nov 07, 2012 at 02:07:33PM +0400, Pavel Emelyanov wrote:
> On 11/06/2012 08:53 PM, Cyrill Gorcunov wrote:
> > 
> > We will use them from crtools code to save and restore blocked
> > signals mask of threads.
> > 
> > Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> > ---
> >  include/parasite-syscall.h |    4 ++++
> >  parasite-syscall.c         |   44 ++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 48 insertions(+), 0 deletions(-)
> > 
> 
> 
> > +int parasite_fini_threads_seized(struct parasite_ctl *ctl, struct pstree_item *item)
> > +{
> > +	struct parasite_thread_args *args = parasite_args(ctl, *args);
> > +	int ret = 0, i;
> > +
> > +	for (i = 0; i < item->nr_threads; i++) {
> > +		if (item->pid.real == item->threads[i].real)
> > +			continue;
> > +
> > +		args->tid = item->threads[i].real;
> > +		ret = parasite_execute_by_pid(PARASITE_CMD_FINI_THREAD, ctl,
> > +					      item->threads[i].real);
> > +		if (ret && ret != -ENOENT) {
> 
> 1. Why -ENOENT check?
> 2. For the last thread reporting ENOENT this error will be reported up w/o log message

Imagine you have 5 threads, then when you've been init'ing them the procedure
failed at 3rd thread, thus only 3 threads will be found on fini call for
4 and 5 there will be -ENOENT, so we should not print any error here
since we're on "curing" path and main error already reported when we
were trying to init the threads.

	Cyrill


More information about the CRIU mailing list