[CRIU] [PATCH] spfs: do not tolerate file existence on creation

Pavel Emelyanov xemul at virtuozzo.com
Thu Jul 7 04:18:18 PDT 2016


On 07/07/2016 12:40 PM, Stanislav Kinsburskiy wrote:
> There are no races in file creation anymore, because they are created
> sequentially by main criu process.
> So, let's treat -EEXIST as error now.
> 
> Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
> ---
>  criu/spfs.c |    8 +++-----

We don't have this thing in criu-dev branch.

>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/criu/spfs.c b/criu/spfs.c
> index 949c333..476af09 100644
> --- a/criu/spfs.c
> +++ b/criu/spfs.c
> @@ -129,10 +129,8 @@ static int create_reg_file(int ns_root_fd, const char *file_path, mode_t mode, s
>  
>  	fd = openat(ns_root_fd, file_path, O_CREAT | O_EXCL | O_WRONLY, 0777);
>  	if (fd < 0) {
> -		if (errno != EEXIST) {
> -			pr_perror("failed to create regular file %s", file_path);
> -			err = -errno;
> -		}
> +		pr_perror("failed to create regular file %s", file_path);
> +		err = -errno;
>  		goto free_path;
>  	}
>  
> @@ -174,7 +172,7 @@ static int create_fifo(int ns_root_fd, const char *file_path, mode_t mode, size_
>  	if (err)
>  		goto free_path;
>  
> -	if (mkfifoat(ns_root_fd, file_path, 0777) && (errno != EEXIST)) {
> +	if (mkfifoat(ns_root_fd, file_path, 0777)) {
>  		pr_perror("failed to create fifo %s", file_path);
>  		err = -errno;
>  		goto free_path;
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
> .
> 



More information about the CRIU mailing list