Quoting Oren Laadan ([email protected]):
> Checkpoint will abort when it detects non-checkpoint-able state. This
> patch fixes a false positive of testing for unlinked files.
> 
> The test for an unlinked file (or directory) is not file system
> agnostic. Commit a3a065e3f13da8a3470ed09c7f38aad256083726 made it
> visible when it changed the behavior of dentry for pipe, sockets and
> anon_inodes (eventfd, timerfd, epoll, signalfd and perf...) to set
> their DCACHE_UNHASHED.
> 
> This is fixed by moving the actual test whether the file is unlinked
> or not to the per filesystem .checkpoint() method, (including the
> default generic_file_checkpoint).
> 
> Signed-off-by: Oren Laadan <[email protected]>

Tested-by: Serge Hallyn <[email protected]>

> ---
>  checkpoint/files.c |   19 ++++++++++---------
>  1 files changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/checkpoint/files.c b/checkpoint/files.c
> index d1242f2..267d361 100644
> --- a/checkpoint/files.c
> +++ b/checkpoint/files.c
> @@ -197,14 +197,20 @@ int generic_file_checkpoint(struct ckpt_ctx *ctx, 
> struct file *file)
>       struct ckpt_hdr_file_generic *h;
>       int ret;
> 
> -     h = ckpt_hdr_get_type(ctx, sizeof(*h), CKPT_HDR_FILE);
> -     if (!h)
> -             return -ENOMEM;
> -
>       /*
>        * FIXME: when we'll add support for unlinked files/dirs, we'll
>        * need to distinguish between unlinked filed and unlinked dirs.
>        */
> +     if (d_unlinked(file->f_dentry)) {
> +             ckpt_err(ctx, -EBADF, "%(T)%(P)Unlinked files unsupported\n",
> +                      file);
> +             return -EBADF;
> +     }
> +
> +     h = ckpt_hdr_get_type(ctx, sizeof(*h), CKPT_HDR_FILE);
> +     if (!h)
> +             return -ENOMEM;
> +
>       h->common.f_type = CKPT_FILE_GENERIC;
> 
>       ret = checkpoint_file_common(ctx, file, &h->common);
> @@ -231,11 +237,6 @@ int checkpoint_file(struct ckpt_ctx *ctx, void *ptr)
>                              file, file->f_op);
>               return -EBADF;
>       }
> -     if (d_unlinked(file->f_dentry)) {
> -             ckpt_err(ctx, -EBADF, "%(T)%(P)Unlinked files unsupported\n",
> -                      file);
> -             return -EBADF;
> -     }
> 
>       ret = file->f_op->checkpoint(ctx, file);
>       if (ret < 0)
> -- 
> 1.6.3.3
_______________________________________________
Containers mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers

_______________________________________________
Devel mailing list
[email protected]
https://openvz.org/mailman/listinfo/devel

Reply via email to