[CRIU] [PATCH] fsmptify: Filter out internal inotify bits when restoring marks

Andrew Vagin avagin at odin.com
Tue Sep 22 04:27:46 PDT 2015


On Tue, Sep 22, 2015 at 12:48:22AM +0300, 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;

I think we need only exclude FS_EVENT_ON_CHILD. Otherwise we will skip a
new flags, when they will add into the kernel.

> +
>  	return collect_inotify_mark(mark);
>  }
>  
> -- 
> 2.4.3
> 


More information about the CRIU mailing list