Re: A possible flaw in the fsnotify design.

Previous thread: [GIT PULL] i2c fixes for 2.6.37 by Jean Delvare on Monday, November 15, 2010 - 2:58 pm. (1 message)

Next thread: [RFC][PATCH] Cross Memory Attach v2 by Christopher Yeoh on Monday, November 15, 2010 - 3:49 pm. (1 message)
From: Eric Paris
Date: Monday, November 15, 2010 - 3:11 pm

That's not true.  Users watch inodes, not files (this is true for both
inotify and fanotify).  Give it a try, it works.

-Eric

--

From: Alexey Zaytsev
Date: Monday, November 15, 2010 - 3:44 pm

debian-i386:~/tmp# touch a
debian-i386:~/tmp# ../fanotify a &
debian-i386:~/tmp# link a b
debian-i386:~/tmp# ls -li
total 0
3433 -rw-r--r-- 2 root root 0 Nov 15 22:37 a
3433 -rw-r--r-- 2 root root 0 Nov 15 22:37 b
debian-i386:~/tmp# echo 123 > b
/root/tmp/b: pid=2143 mask = 20 open
/root/tmp/b: pid=2143 mask = a modify 0 - 4 close(writable)  0 - 4

Am I doing something wrong? Same thing happens if I watch the mount point.
--

From: Eric Paris
Date: Monday, November 15, 2010 - 3:51 pm

Maybe I don't understand the problem, you watched the inode behind A.
You made changes accessing this inode via B, you got notification about
those changes.  Isn't that what you wanted?

--

From: Alexey Zaytsev
Date: Monday, November 15, 2010 - 4:03 pm

I'd expect to get two notifications in this case. Might not be a
problem when you are watching individual files, but there is no clear
way to get all the modified files, if you are watching a mount point.
--

From: Eric Paris
Date: Monday, November 15, 2010 - 4:12 pm

Ah, you were hoping for 4 events.  Yeah, not possible.  You get notified
when the inode changes, which way you get notified is up to the kernel
and we leave it as an (impossible) exercise to userspace to map hard
linked inodes back together   :)


--

From: Alexey Zaytsev
Date: Monday, November 15, 2010 - 4:15 pm

Yeah, I see now, it's impossible to get all the files linking to an
inode even from the kernel space without scanning the fs. Thanks for
the clarification.
--

Previous thread: [GIT PULL] i2c fixes for 2.6.37 by Jean Delvare on Monday, November 15, 2010 - 2:58 pm. (1 message)

Next thread: [RFC][PATCH] Cross Memory Attach v2 by Christopher Yeoh on Monday, November 15, 2010 - 3:49 pm. (1 message)