From: Andreas Gruenbacher <agruen@suse.de>
To: Eric Paris <eparis@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>,
Matt Helsley <matthltc@us.ibm.com>,
torvalds@linux-foundation.org, linux-kernel@vger.kernel.org,
viro@zeniv.linux.org.uk, akpm@linux-foundation.org,
Michael Kerrisk <michael.kerrisk@gmail.com>,
linux-fsdevel@vger.kernel.org
Subject: Re: [GIT PULL] notification tree: directory events
Date: Fri, 20 Aug 2010 01:41:09 +0200 [thread overview]
Message-ID: <201008200141.10068.agruen@suse.de> (raw)
In-Reply-To: <1282230012.21419.1566.camel@acb20005.ipt.aol.com>
[Adding linux-fsdevel to the list as this really is a filesystem discussion.]
On Thursday 19 August 2010 17:00:12 Eric Paris wrote:
> On Thu, 2010-08-19 at 14:44 +0200, Andreas Gruenbacher wrote:
> > On Wednesday 18 August 2010 17:59:06 Eric Paris wrote:
> >
> > The half-thought-out directory events are not part of this subset though.
> > They are not useful in their own right and only generate overheads, and
> > much worse, they could even get in the way when proper directory event
> > support is eventually added. So that part should really be removed
> > ASAP.
>
> They aren't something I specifically added so you can call them
> zero-thought-out. fanotify is just a userspace interface on top of the
> notification infrastructure in the kernel. The events the
> infrastructure delivers are the events it sends.
Apparently the infrastructure delivers a number of directory events like file
creation, deletion, and renames through inotify that are not delivered through
fanotify, and fanotify only sees a subset of all directory events. The result
is that directory events for inotify are useful because they allow to watch a
directory for changes, and the directory events in fanotify are not useful for
that right now.
>[...]
>> Your changes could be as simple as defining a new flag and then add an
> if (flag && S_IFDIR(i_mode)) to the fanotify_should_send_event handler.
> I'd love to hear objections, failings, short comings, or suggestions if
> you think the interface is inadequate to address these or other needs.
I don't think the events that fanotify delivers for directories (open_perm,
open, access_perm, close) are useful at all, or that we should allow perm
events for directories.
So let's please get rid of those directory events unconditionally now, and add
them back in their proper, final form later, after 2.6.36.
> > We are not talking about Eric's own private syscalls here. Things we
> > screw up now may be very hard or impossible to fix later; syscalls don't
> > just change from release to release.
>
> Which is why there was so much discussion and reworking of the
> interface. It went through many iterations to end up here. What all
> did we have in those discussions? 2 magic proc files, ioctls on a char
> dev, netlink, a socket with get/setsockopt and eventually we landed on 2
> syscalls that noone found fault with.
Unfortunately there wasn't a lot of discussion about which events should be
generated when. Fanotify was merged before turning into a superset of
inotify, and there was even less discussion about how fanotify should look if
it isn't a superset of inotify.
> > This also applies to the error reporting mess I have commented on. At
> > least the interface should be changed so that it can report a valid file
> > descriptor and an error condition at the same time; otherwise, we will
> > end up with a weakness in the interface that we won't be able to fix.
>
> Can you describe your problem for me again. I'm not sure I understand
> your request. I don't understand how we have an error and a valid fd at
> the same time.
Yes. Right now, struct fanotify_event_metadata contains a file descriptor
which is the only information we have about the object the event refers to, or
a negative error code if a file descriptor could not be opened with
dentry_open() or some other error occurred.
Being able to identify the object that an event refers to is important. There
are two ways to do that:
(1) Include fields like st_dev and st_ino in struct
fanotify_event_metadata. This is not ideal because the listener
won't be able to find out any additional information about the file
(like an idea about its name, for example).
For example, if inode->i_generation is ever exposed to user-space
through stat(), that information would still be missing in struct
fanotify_event_metadata.
(2) Construct a file descriptor that refers to the file that could not be
dentry_open()ed, but which cannot be used for any I/O, and pass the
error condition in a separate field. The kernel has all the
information needed for doing that, and it shouldn't be hard to
implement.
That way, the listener always has a file descriptor to poke around
with.
Failing to do (2) right now, I think it still makes sense to separate the file
descriptor from the error code in struct fanotify_event_metadata; this would
enable us to do (2) later if we decide to.
> I understand you want new features but I'm not seeing failures of the
> interface to be forward looking or failures in the feature set that is
> provided.
I do see failures of being forward looking, inconsistencies in the feature set
which might lead to trouble as we extend fanotify in the future, and bugs that
would have been shaken out in a proper review (OOMing the system when a
listener stops listening or blocking access to files when a listener dies; I
have reported that).
Sorry to say, but this code really should not have been merged yet. (And mind
I'm not saying this because I want to block fanotify from making progress --
quite the contrary.)
Andreas
next prev parent reply other threads:[~2010-08-19 23:41 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-06 15:58 [GIT PULL] notification tree - try 37! Eric Paris
2010-08-06 23:34 ` Matt Helsley
2010-08-07 0:06 ` Christoph Hellwig
2010-08-07 19:15 ` Eric Paris
2010-08-07 20:55 ` Matt Helsley
2010-08-16 20:32 ` Andreas Gruenbacher
2010-08-17 3:39 ` Eric Paris
[not found] ` <1282016387.21419.113.camel-u/cB4NFi02V49Jlha2NJH1aTQe2KTcn/@public.gmane.org>
2010-08-17 4:03 ` Matt Helsley
2010-08-17 4:03 ` Matt Helsley
2010-08-17 8:09 ` Andreas Gruenbacher
2010-08-17 15:08 ` Eric Paris
2010-08-19 20:24 ` Andreas Gruenbacher
2010-08-19 20:32 ` Andreas Gruenbacher
2010-08-19 20:42 ` Eric Paris
2010-08-19 21:07 ` Andreas Gruenbacher
2010-08-19 21:22 ` Andreas Gruenbacher
2010-08-20 3:50 ` Eric Paris
2010-08-20 12:38 ` Andreas Gruenbacher
2010-08-23 16:46 ` Eric Paris
2010-08-23 22:38 ` Andreas Gruenbacher
2010-08-20 0:00 ` Andreas Gruenbacher
2010-08-17 8:38 ` Andreas Gruenbacher
2010-08-17 15:24 ` Eric Paris
2010-08-17 15:48 ` Andreas Gruenbacher
2010-08-18 14:18 ` Andreas Gruenbacher
2010-08-17 9:45 ` Tvrtko Ursulin
2010-08-17 10:01 ` Andreas Gruenbacher
2010-08-17 10:12 ` Tvrtko Ursulin
2010-08-17 10:55 ` Tvrtko Ursulin
2010-08-17 15:27 ` Eric Paris
2010-08-18 15:47 ` [GIT PULL] notification tree: directory events Andreas Gruenbacher
2010-08-18 15:59 ` Eric Paris
2010-08-18 16:42 ` Christoph Hellwig
2010-08-18 17:07 ` Eric Paris
2010-08-19 12:44 ` Andreas Gruenbacher
2010-08-19 15:00 ` Eric Paris
2010-08-19 23:41 ` Andreas Gruenbacher [this message]
2010-08-20 3:38 ` Eric Paris
2010-08-20 5:19 ` Andreas Dilger
2010-08-20 9:21 ` Christoph Hellwig
2010-08-20 15:29 ` Andreas Gruenbacher
2010-08-20 20:39 ` Andreas Dilger
2010-08-20 9:09 ` Tvrtko Ursulin
2010-08-20 11:07 ` Andreas Gruenbacher
2010-08-20 11:25 ` Andreas Gruenbacher
2010-08-20 12:16 ` Andreas Gruenbacher
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=201008200141.10068.agruen@suse.de \
--to=agruen@suse.de \
--cc=akpm@linux-foundation.org \
--cc=eparis@redhat.com \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthltc@us.ibm.com \
--cc=michael.kerrisk@gmail.com \
--cc=torvalds@linux-foundation.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.