Commit 3f802388 authored by Pavel Emelyanov's avatar Pavel Emelyanov

fsnotify: Add comment saying why we attach watches via /proc/self/fd/

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 7eb20e7d
...@@ -216,6 +216,15 @@ static char *get_mark_path(const char *who, struct file_remap *remap, ...@@ -216,6 +216,15 @@ static char *get_mark_path(const char *who, struct file_remap *remap,
s_dev, i_ino); s_dev, i_ino);
goto err; goto err;
} }
/*
* fanotify/inotify open syscalls want path to attach
* watch to. But the only thing we have is an FD obtained
* via fhandle. Fortunatelly, when trying to attach the
* /proc/pid/fd/ link, we will watch the inode the link
* points to, i.e. -- just what we want.
*/
snprintf(buf, size, "/proc/self/fd/%d", *target); snprintf(buf, size, "/proc/self/fd/%d", *target);
path = buf; path = buf;
......
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