[CRIU] [PATCH v2] locks: skip 'lease correction' for non-regular files

Andrei Vagin avagin at virtuozzo.com
Sat Nov 25 21:04:53 MSK 2017


Applied, thanks!

On Tue, Nov 21, 2017 at 06:00:33AM +0300, Pavel Begunkov (Silence) wrote:
> From: Pavel Begunkov <asml.silence at gmail.com>
> 
> Leases can be set only on regular files. Thus, as optimization we can
> skip attempts to find associated leases in 'correct_file_leases_type'
> for other fd types.
> 
> Signed-off-by: Pavel Begunkov <asml.silence at gmail.com>
> ---
>  criu/files.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/criu/files.c b/criu/files.c
> index 4f6b0378..8394ef46 100644
> --- a/criu/files.c
> +++ b/criu/files.c
> @@ -489,8 +489,13 @@ static int dump_one_file(struct pid *pid, int fd, int lfd, struct fd_opts *opts,
>  	if (note_file_lock(pid, fd, lfd, &p))
>  		return -1;
>  
> -	if (correct_file_leases_type(pid, fd, lfd))
> -		return -1;
> +	/* Lease can be set only on regular file */
> +	if (S_ISREG(p.stat.st_mode)) {
> +		int ret = correct_file_leases_type(pid, fd, lfd);
> +
> +		if (ret < 0)
> +			return ret;
> +	}
>  
>  	p.fd_ctl = ctl; /* Some dump_opts require this to talk to parasite */
>  
> -- 
> 2.14.1.473.g3ec7d702a8
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list