[CRIU] [PATCH] fsnotify: Open handle with O_PATH

Cyrill Gorcunov gorcunov at openvz.org
Mon Feb 24 09:31:56 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>
---

 fsnotify.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fsnotify.c b/fsnotify.c
index 3f5ef6280bc8..641abcf216c5 100644
--- a/fsnotify.c
+++ b/fsnotify.c
@@ -114,10 +114,12 @@ static int open_handle(unsigned int s_dev, unsigned long i_ino,
 		goto out;
 	}
 
-	fd = sys_open_by_handle_at(mntfd, (void *)&handle, 0);
-	if (fd < 0)
+	fd = sys_open_by_handle_at(mntfd, (void *)&handle, O_PATH);
+	if (fd < 0) {
+		errno = -fd;
 		pr_perror("Can't open file handle for 0x%08x:0x%016lx",
 				s_dev, i_ino);
+	}
 
 	close(mntfd);
 out:
-- 
1.8.3.1



More information about the CRIU mailing list