Commit 4ff68eeb authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Andrei Vagin

fsnotify: Filter event mask from old kernels

When checkpoint is done on the kernels where
commit 6933599697c96c3213c95f5f1fc7cb6abfd08c54
is not yet present then mask is not filtered
and saved in image in this raw form.

For such case restore on more modern kernels
will fail because only a small set of events
are allowed to pass from userspace.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 251b4d06
......@@ -551,12 +551,19 @@ static int restore_one_inotify(int inotify_fd, struct fsnotify_mark_info *info)
InotifyWdEntry *iwe = info->iwe;
int ret = -1, target = -1;
char buf[PSFDS], *path;
uint32_t mask;
path = get_mark_path("inotify", info->remap, iwe->f_handle,
iwe->i_ino, iwe->s_dev, buf, &target);
if (!path)
goto err;
mask = iwe->mask & IN_ALL_EVENTS;
if (iwe->mask & ~IN_ALL_EVENTS) {
pr_info("\t\tfilter event mask %#x -> %#x\n",
iwe->mask, mask);
}
/*
* FIXME The kernel allocates wd-s sequentially,
* this is suboptimal, but the kernel doesn't
......@@ -565,7 +572,7 @@ static int restore_one_inotify(int inotify_fd, struct fsnotify_mark_info *info)
while (1) {
int wd;
wd = inotify_add_watch(inotify_fd, path, iwe->mask);
wd = inotify_add_watch(inotify_fd, path, mask);
if (wd < 0) {
pr_perror("Can't add watch for 0x%x with 0x%x", inotify_fd, iwe->wd);
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment