[CRIU] [PATCH] inotify: Skip opening deleted file

Pavel Emelyanov xemul at parallels.com
Wed Nov 28 12:28:59 EST 2012


On 11/28/2012 09:26 PM, Cyrill Gorcunov wrote:
> In case if we're monitoring deleted file we can't open
> it on restore procedure, thus simply skip its recreation.

NAK. This should be done the other way.

On dump we should find out, that the file is unlinked and note this
fact in the image. On restore we should restore a temp file, inotify
it and unlink back.

> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  inotify.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/inotify.c b/inotify.c
> index 46b1797..207f1ea 100644
> --- a/inotify.c
> +++ b/inotify.c
> @@ -131,6 +131,12 @@ static int restore_one_inotify(int inotify_fd, InotifyWdEntry *iwe)
>  
>  	target = sys_open_by_handle_at(mntfd, (void *)&handle, 0);
>  	if (target < 0) {
> +		if (errno == EBADF) {
> +			pr_info("Skip opening deleted file handle for 0x%08x:0x%016lx",
> +				  iwe->s_dev, iwe->i_ino);
> +			close(mntfd);
> +			return 0;
> +		}
>  		pr_perror("Can't open file handle for 0x%08x:0x%016lx",
>  			  iwe->s_dev, iwe->i_ino);
>  		return -1;
> 




More information about the CRIU mailing list