[CRIU] [PATCH 2/3] fsnotify: dump tmpfs notify watchers by names

Cyrill Gorcunov gorcunov at gmail.com
Mon Feb 24 06:20:55 PST 2014


On Mon, Feb 24, 2014 at 06:11:29PM +0400, Andrey Vagin wrote:
> Currently file handles are used for dumping {i,fs}notify watchers.
> 
> But inode numbers are not restored for tmpfs content, so watchers can't
> be opened by handles.
> 
> Pavel found, that tmpfs cache is not pruned, so a handle can be opened,
> and readlink(/proc/PID/fd/X) will return a corect path to the file.
...
> +		if (mi->fstype->code == FSTYPE__TMPFS) {
> +			char p[PATH_MAX];
> +			int s;
> +
> +			snprintf(p, sizeof(p), "/proc/self/fd/%d", fd);
> +			s = readlink(p, p, sizeof(p) - 1);
> +			if (s < 0) {
> +				pr_perror("Unable to readlink(%s)", p);
> +				goto err;
> +			}

Maybe to use read_fd_link() helper?


More information about the CRIU mailing list