From: Christian Brauner <brauner@kernel.org>
To: Jan Kara <jack@suse.cz>
Cc: Amir Goldstein <amir73il@gmail.com>,
Miklos Szeredi <miklos@szeredi.hu>,
Al Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fsnotify: move fsnotify_open() hook into do_dentry_open()
Date: Mon, 12 Jun 2023 11:35:12 +0200 [thread overview]
Message-ID: <20230612-aufzuarbeiten-geklebt-5af9b817f764@brauner> (raw)
In-Reply-To: <20230612085431.ycbzjj7wk6qij3qf@quack3>
On Mon, Jun 12, 2023 at 10:54:31AM +0200, Jan Kara wrote:
> On Sun 11-06-23 15:24:29, Amir Goldstein wrote:
> > fsnotify_open() hook is called only from high level system calls
> > context and not called for the very many helpers to open files.
> >
> > This may makes sense for many of the special file open cases, but it is
> > inconsistent with fsnotify_close() hook that is called for every last
> > fput() of on a file object with FMODE_OPENED.
> >
> > As a result, it is possible to observe ACCESS, MODIFY and CLOSE events
> > without ever observing an OPEN event.
> >
> > Fix this inconsistency by replacing all the fsnotify_open() hooks with
> > a single hook inside do_dentry_open().
> >
> > If there are special cases that would like to opt-out of the possible
> > overhead of fsnotify() call in fsnotify_open(), they would probably also
> > want to avoid the overhead of fsnotify() call in the rest of the fsnotify
> > hooks, so they should be opening that file with the __FMODE_NONOTIFY flag.
> >
> > However, in the majority of those cases, the s_fsnotify_connectors
> > optimization in fsnotify_parent() would be sufficient to avoid the
> > overhead of fsnotify() call anyway.
> >
> > Signed-off-by: Amir Goldstein <amir73il@gmail.com>
>
> Thanks! The cleanup looks nice so I've applied it with the typo fixup from
> Christian. I have a slight worry this might break something subtle
> somewhere but after searching for a while I didn't find anything and the
> machine boots and ltp tests pass so it's worth a try :)
Yep, I agree. If we can reduce cluttering multiple places with
fsnotify_open() and instead move it to a central location it's a
maintenance win in the long term.
prev parent reply other threads:[~2023-06-12 9:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-11 12:24 [PATCH] fsnotify: move fsnotify_open() hook into do_dentry_open() Amir Goldstein
2023-06-12 6:43 ` Christian Brauner
2023-06-12 8:54 ` Jan Kara
2023-06-12 9:35 ` Christian Brauner [this message]
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=20230612-aufzuarbeiten-geklebt-5af9b817f764@brauner \
--to=brauner@kernel.org \
--cc=amir73il@gmail.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--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).