[CRIU] [PATCH] fsmptify: Filter out internal inotify bits when restoring marks
Pavel Emelyanov
xemul at parallels.com
Mon Oct 12 03:27:12 PDT 2015
On 09/22/2015 12:48 AM, Cyrill Gorcunov wrote:
> The kernel prior 4.3 is exporting FS_EVENT_ON_CHILD
> bit via procfs fdinfo interface. This bit is kernel's
> internal and should not be passed in inotify_add_watch
> call. Thus simply filter it out when obtain from old
> images for backward compatibility reason.
>
> More details here https://lkml.org/lkml/2015/9/21/680
>
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
> fsnotify.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/fsnotify.c b/fsnotify.c
> index 9b1323363457..17abd499c337 100644
> --- a/fsnotify.c
> +++ b/fsnotify.c
> @@ -801,6 +801,16 @@ static int collect_one_inotify_mark(void *o, ProtobufCMessage *msg)
> INIT_LIST_HEAD(&mark->list);
> mark->remap = NULL;
>
> + /*
> + * The kernel prior 4.3 might export internal event
> + * mask bits which are not part of user-space API. It
> + * is fixed in kernel but we have to keep backward
> + * compatibility with old images. So mask out
> + * inappropriate bits (in particular fdinfo might
> + * have FS_EVENT_ON_CHILD bit set).
> + */
> + mark->iwe->mask &= IN_ALL_EVENTS;
OK, so after thinking about it more, here's what seems correct to me:
1. On restore drop the FS_EVENT_ON_CHILD from image unconditionally.
2. On dump check for this bit and pr_warn if present.
> +
> return collect_inotify_mark(mark);
> }
>
>
More information about the CRIU
mailing list