[CRIU] [PATCH 5/7] tty: Save mount ids for terminals into image

Cyrill Gorcunov gorcunov at gmail.com
Tue Jan 31 04:04:08 PST 2017


On Tue, Jan 31, 2017 at 02:32:55PM +0300, Pavel Emelyanov wrote:
> >  
> > +static struct mount_info *lookup_mnt_sdev_on_root(unsigned int s_dev)
> > +{
> > +	struct mount_info *m;
> > +
> > +	for (m = mntinfo; m != NULL; m = m->next)
> > +		if (m->s_dev == s_dev &&
> > +		    is_root(m->root))
> 
> Why is is_root() check needed?

To skip bindmounts.

> > @@ -289,7 +301,7 @@ int mount_resolve_devpts_mnt_id(int s_dev)
> >  	} else if (mi->fstype->code == FSTYPE__DEVTMPFS) {
> >  		char path[PATH_MAX];
> >  
> > -		snprintf(path, sizeof(path), "%s/pts", mi->mountpoint + 1);
> > +		snprintf(path, sizeof(path), "%s/pts/ptmx", mi->mountpoint + 1);
> 
> Runaway from patch #4?

yup

> > +	if (is_pty(driver)) {
> > +		mnt_id = mount_resolve_devpts_mnt_id(p->stat.st_dev);
> > +		if (mnt_id < 0) {
> > +			pr_info("Can't obtain mnt_id on tty %d id %#x\n", lfd, id);
> > +			return -1;
> > +		}
> > +	} else
> > +		mnt_id = p->mnt_id;
> 
> Is it needed for non-ptys?

Well, I think better to carry this info for _any_ type of terminal.
Maybe it won't be needed for non-ptys but wont hurt.

> >  
> >  message tty_file_entry {
> > @@ -81,4 +85,6 @@ message tty_file_entry {
> >  
> >  	required uint32			flags		= 3 [(criu).hex = true];
> >  	required fown_entry		fown		= 4;
> > +
> > +	optional sint32			mnt_id		= 5 [default = 0];
> 
> O_o  do we _really_ need mnt_id for all three?
> 

Yes, one tty-info may belong to several tty-file (say
tty opened more than once)

	Cyrill


More information about the CRIU mailing list