[CRIU] [PATCH] dump: Don't close pid-proc in vain

Andrew Vagin avagin at parallels.com
Wed Sep 24 00:18:02 PDT 2014


On Tue, Sep 23, 2014 at 08:44:24PM +0400, Pavel Emelyanov wrote:
> On 09/23/2014 01:39 PM, Andrew Vagin wrote:
> > On Mon, Sep 22, 2014 at 05:40:02PM +0400, Pavel Emelyanov wrote:
> >> The open_pid_proc engine knows itself how to cache
> >> per-pid descriptors. No need in closing it by hands.
> >>
> >> Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
> >>
> >> ---
> >>
> >> diff --git a/cr-dump.c b/cr-dump.c
> >> index d00c158..890d60a 100644
> >> --- a/cr-dump.c
> >> +++ b/cr-dump.c
> >> @@ -1041,8 +1041,6 @@ static int collect_task(struct pstree_item *item)
> >>  	if (pstree_alloc_cores(item))
> >>  		goto err_close;
> >>  
> >> -	close_pid_proc();
> >> -
> >>  	pr_info("Collected %d in %d state\n", item->pid.real, item->state);
> >>  	return 0;
> > err_close:
> >         close_pid_proc();
> > 		^^^
> > Let's remove close_pid_proc() from here too?
> 
> I don't mind, but we have much more of them on other error paths :)
> Error paths are not interesting from this perspective, however.

I'm agree, but I don't want to think in a future why do we have it in a
error path and doesn't have in another case. So it's just for easy
reading.

> 
> >         return -1;
> > }
> > 
> >>  
> >> _______________________________________________
> >> CRIU mailing list
> >> CRIU at openvz.org
> >> https://lists.openvz.org/mailman/listinfo/criu
> > .
> > 
> 


More information about the CRIU mailing list