[CRIU] Re: [PATCH 3/4] inotify: Add checkpoint/restore

Pavel Emelyanov xemul at parallels.com
Wed Apr 11 14:50:36 EDT 2012


Pre-question. Where are the required kernel patches?

> +struct inotify_file_entry {
> +	u32	id;
> +	u16	flags;
> +	u64	i_ino;
> +	u32	mask;
> +	u32	s_dev;
> +	u32	r_dev;
> +	u32	wd;
> +	fh_t	f_handle;
> +} __packed;
> +


I asked to put two image entries in this file. One for
inotify fd itself and an array of watches behind. Plz, 
do it right now, don't postpone. Even if the former image
is one field (an ID) only. Flags and fownres can come later.

>  	if (S_ISREG(p.stat.st_mode) ||
>              S_ISDIR(p.stat.st_mode) ||
> -            S_ISFIFO(p.stat.st_mode))
> +            S_ISFIFO(p.stat.st_mode) ||
> +	    is_inotify(lfd))
>  		return dump_gen_file(&p, lfd, cr_fdset);


No, no, no. This should look like this.

if (is_anon_inode())
	return dump_anon_inode();

where

int dump_anon_inode()
{
	readlink()
	if (strcmp(buf, "inotify")) {
		p->type = FDINFO_INOTIFY;
		return dump_gen_file();
	}

	...
}

> +static char *get_mnt_root(unsigned int s_dev,
> +			  struct proc_mountinfo *mntinfo,
> +			  int nr_mntinfo)
> +{
> +	static int last = 0;
> +	int i;
> +
> +	/* Cache hit rate is big */
> +again:
> +	for (i = last; i < nr_mntinfo; i++) {
> +		if (s_dev == mntinfo[i].s_dev) {
> +			last = i;
> +			return mntinfo[i].mnt_root;
> +		}
> +	}
> +
> +	if (last) {
> +		last = 0;
> +		goto again;
> +	}
> +
> +	return NULL;
> +}
> +

I asked to put this in another .c file. The util.c one is OK for now.


More information about the CRIU mailing list