[CRIU] [PATCH 11/14] files: dump fdinfo per files_id instead of pid (v2)

Andrew Vagin avagin at parallels.com
Fri Jan 11 06:53:44 EST 2013


On Fri, Jan 11, 2013 at 02:50:19PM +0400, Pavel Emelyanov wrote:
> > -int prepare_fd_pid(int pid, struct rst_info *rst_info)
> > +int prepare_fd_pid(struct pstree_item *item)
> >  {
> >  	int fdinfo_fd, ret = 0;
> > +	pid_t pid = item->pid.virt;
> > +	struct rst_info *rst_info = item->rst;
> >  
> >  	INIT_LIST_HEAD(&rst_info->fds);
> >  	INIT_LIST_HEAD(&rst_info->eventpoll);
> >  	INIT_LIST_HEAD(&rst_info->tty_slaves);
> >  
> > -	fdinfo_fd = open_image_ro(CR_FD_FDINFO, pid);
> > -	if (fdinfo_fd < 0) {
> > -		if (errno == ENOENT)
> > +	if (!fdinfo_per_id) {
> > +		fdinfo_fd = open_image_ro(CR_FD_FDINFO, pid);
> > +		if (fdinfo_fd < 0) {
> > +			if (errno == ENOENT)
> > +				return 0;
> > +			return -1;
> > +		}
> > +	} else {
> > +		if (item->ids == NULL) /* zombie */
> >  			return 0;
> 
> Check for zombie should be using item->state and precede both open models.

item->state is not avaliable here. A task state is in core-PID.img

> Thus the ENOENT check above will go away.
> 
> > -		else
> > +
> > +		if (item->rst->fdt && item->rst->fdt->pid != item->pid.virt)
> > +			return 0;
> > +
> > +		fdinfo_fd = open_image_ro(CR_FD_FDINFO, item->ids->files_id);
> > +		if (fdinfo_fd < 0)
> >  			return -1;
> >  	}
> >  


More information about the CRIU mailing list