[CRIU] [PATCH] [RFC] fsnotify: don't call check_open_handle() for remapped and ghost files
Pavel Emelyanov
xemul at parallels.com
Wed Sep 3 10:05:54 PDT 2014
On 09/02/2014 02:17 PM, Andrey Vagin wrote:
> Handles are not used for restoring these files. AUFS can't open unlinked
> files by handle.
>
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
> fsnotify.c | 19 ++++++++++---------
> 1 file changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/fsnotify.c b/fsnotify.c
> index 09b793d..9a1c7dd 100644
> --- a/fsnotify.c
> +++ b/fsnotify.c
> @@ -215,11 +215,6 @@ static int dump_inotify_entry(union fdinfo_entries *e, void *arg)
> we->f_handle->bytes, we->f_handle->type,
> we->f_handle->handle[0], we->f_handle->handle[1]);
>
> - if (check_open_handle(we->s_dev, we->i_ino, we->f_handle)) {
> - free_inotify_wd_entry(e);
> - return -1;
> - }
> -
You move check_open_handle from dump to restore stage. This is not
nice from my POV, as handle checking is important at dump stage since
it gives us ... some guarantee, that we will have chances to use it
on restore.
> list_add(&wd_entry->node, &wd_list->list);
> wd_list->n++;
>
> @@ -299,9 +294,6 @@ static int dump_fanotify_entry(union fdinfo_entries *e, void *arg)
> pr_info("\t[fhandle] bytes 0x%08x type 0x%08x __handle 0x%016"PRIx64":0x%016"PRIx64"\n",
> fme->ie->f_handle->bytes, fme->ie->f_handle->type,
> fme->ie->f_handle->handle[0], fme->ie->f_handle->handle[1]);
> -
> - if (check_open_handle(fme->s_dev, fme->ie->i_ino, fme->ie->f_handle))
> - goto out;
> }
>
> if (fme->type == MARK_TYPE__MOUNT) {
> @@ -668,6 +660,11 @@ static int __collect_inotify_mark(struct fsnotify_file_info *p, struct fsnotify_
>
> list_add_tail(&mark->list, &m->list);
> mark->remap = lookup_ghost_remap(mark->iwe->s_dev, mark->iwe->i_ino);
> + if (mark->remap == NULL &&
> + check_open_handle(mark->iwe->s_dev, mark->iwe->i_ino, mark->iwe->f_handle)) {
> + return -1;
> + }
> +
> return 0;
> }
>
> @@ -686,9 +683,13 @@ static int __collect_fanotify_mark(struct fsnotify_file_info *p,
> struct fsnotify_mark_info *mark)
> {
> list_add(&mark->list, &p->marks);
> - if (mark->fme->type == MARK_TYPE__INODE)
> + if (mark->fme->type == MARK_TYPE__INODE) {
> mark->remap = lookup_ghost_remap(mark->fme->s_dev,
> mark->fme->ie->i_ino);
> + if (mark->remap == NULL &&
> + check_open_handle(mark->fme->s_dev, mark->fme->ie->i_ino, mark->fme->ie->f_handle))
> + return -1;
> + }
> return 0;
> }
>
>
More information about the CRIU
mailing list