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

Cyrill Gorcunov gorcunov at openvz.org
Mon Sep 21 14:48:22 PDT 2015


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;
+
 	return collect_inotify_mark(mark);
 }
 
-- 
2.4.3



More information about the CRIU mailing list