From: Eric Paris <eparis@redhat.com>
To: Alexey Zaytsev <alexey.zaytsev@gmail.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@sophos.com>,
linux-fsdevel@vger.kernel.org,
"stefan@buettcher.org" <stefan@buettcher.org>,
linux-kernel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
agruen@linbit.com
Subject: Re: A possible flaw in the fsnotify design.
Date: Mon, 15 Nov 2010 18:12:34 -0500 [thread overview]
Message-ID: <1289862754.14282.49.camel@localhost.localdomain> (raw)
In-Reply-To: <AANLkTikAczyi0FQaSV4eVL5prdVbyZj6QCkPbf7cMW47@mail.gmail.com>
On Tue, 2010-11-16 at 02:03 +0300, Alexey Zaytsev wrote:
> On Tue, Nov 16, 2010 at 01:51, Eric Paris <eparis@redhat.com> wrote:
> > On Tue, 2010-11-16 at 01:44 +0300, Alexey Zaytsev wrote:
> >> On Tue, Nov 16, 2010 at 01:11, Eric Paris <eparis@redhat.com> wrote:
> >> > On Tue, 2010-11-16 at 01:05 +0300, Alexey Zaytsev wrote:
> >> >> Just some thoughts.
> >> >>
> >> >> Consider the situation: Files A and B both point to the same inode.
> >> >> File A is being watched, but the user won't get notifications if B is
> >> >> modified.
> >> >
> >> > That's not true. Users watch inodes, not files (this is true for both
> >> > inotify and fanotify). Give it a try, it works.
> >> >
> >>
> >> 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.
> >
> > 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?
>
> 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.
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 :)
next prev parent reply other threads:[~2010-11-15 23:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-15 22:05 A possible flaw in the fsnotify design Alexey Zaytsev
2010-11-15 22:11 ` Eric Paris
2010-11-15 22:44 ` Alexey Zaytsev
2010-11-15 22:51 ` Eric Paris
2010-11-15 23:03 ` Alexey Zaytsev
2010-11-15 23:12 ` Eric Paris [this message]
2010-11-15 23:15 ` Alexey Zaytsev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1289862754.14282.49.camel@localhost.localdomain \
--to=eparis@redhat.com \
--cc=agruen@linbit.com \
--cc=alexey.zaytsev@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stefan@buettcher.org \
--cc=tvrtko.ursulin@sophos.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).