diff --git a/fsnotify.c b/fsnotify.c index 931e76785..a7acc9672 100644 --- a/fsnotify.c +++ b/fsnotify.c @@ -223,6 +223,10 @@ 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 (we->mask & KERNEL_FS_EVENT_ON_CHILD) + pr_warn_once("\t\tDetected FS_EVENT_ON_CHILD bit " + "in mask (will be ignored on restore)\n"); + if (check_open_handle(we->s_dev, we->i_ino, we->f_handle)) { free_inotify_wd_entry(e); return -1; @@ -813,6 +817,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 &= ~KERNEL_FS_EVENT_ON_CHILD; + return collect_inotify_mark(mark); } diff --git a/include/fsnotify.h b/include/fsnotify.h index 3fd5307e0..48e3982cf 100644 --- a/include/fsnotify.h +++ b/include/fsnotify.h @@ -7,6 +7,8 @@ #include "protobuf.h" #include "protobuf/fsnotify.pb-c.h" +#define KERNEL_FS_EVENT_ON_CHILD 0x08000000 + struct fsnotify_params { u32 faflags; u32 evflags;