[CRIU] [PATCH 6/7] inotify: Use ghost files if the watchee is a deleted file

Pavel Emelyanov xemul at parallels.com
Wed Dec 5 07:48:28 EST 2012


> @@ -131,12 +133,16 @@ static int restore_one_inotify(int inotify_fd, InotifyWdEntry *iwe)
>  
>  	target = sys_open_by_handle_at(mntfd, (void *)&handle, 0);
>  	if (target < 0) {
> -		pr_perror("Can't open file handle for 0x%08x:0x%016lx",
> -			  iwe->s_dev, iwe->i_ino);
> -		goto err;
> -	}
> +		gf = lookup_ghost_file_st(iwe->s_dev, iwe->i_ino);

At that point gf may have already being removed. The fact that you bump up
users _here_ doesn't work. Users should be counted before actual restore starts.

> +		if (!gf) {
> +			pr_perror("Can't open file handle for 0x%08x:0x%016lx",
> +				  iwe->s_dev, iwe->i_ino);
> +			goto err;
> +		}
> +		path = gf->remap.path;
> +	} else
> +		snprintf(buf, sizeof(buf), "/proc/self/fd/%d", target);
>  
> -	snprintf(path, sizeof(path), "/proc/self/fd/%d", target);
>  	pr_debug("\t\tRestore watch for 0x%08x:0x%016lx\n", iwe->s_dev, iwe->i_ino);
>  
>  	/*



More information about the CRIU mailing list