[PATCH v2] fsnotify: Open handle with O_PATH
Cyrill Gorcunov
gorcunov at openvz.org
Mon Feb 24 08:44:40 PST 2014
Otherwise if the mark is set up on link we end
with -ELOOP error trying to open it. Thus, use
O_PATH pointing the kernel that we're not going
to read/write this descriptor.
Repored-by: Andrew Vagin <avagin at parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
Acked-by: Andrew Vagin <avagin at parallels.com>
---
Add definition of O_PATH.
fsnotify.c | 2 +-
include/fcntl.h | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/fsnotify.c b/fsnotify.c
index 3f5ef6280bc8..476fb2620bd0 100644
--- a/fsnotify.c
+++ b/fsnotify.c
@@ -114,7 +114,7 @@ static int open_handle(unsigned int s_dev, unsigned long i_ino,
goto out;
}
- fd = sys_open_by_handle_at(mntfd, (void *)&handle, 0);
+ fd = sys_open_by_handle_at(mntfd, (void *)&handle, O_PATH);
if (fd < 0)
pr_perror("Can't open file handle for 0x%08x:0x%016lx",
s_dev, i_ino);
diff --git a/include/fcntl.h b/include/fcntl.h
index 65ba2bfe2632..6f85c5ee6923 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -29,4 +29,8 @@ struct f_owner_ex {
# define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
#endif
+#ifndef O_PATH
+# define O_PATH 010000000
+#endif
+
#endif /* __CR_ASM_GENERIC_FCNTL_H__ */
--
1.8.3.1
--jKBxcB1XkHIR0Eqt--
More information about the CRIU
mailing list