From: Matthew Bobrowski <repnop@google.com>
To: Jan Kara <jack@suse.cz>
Cc: Amir Goldstein <amir73il@gmail.com>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [RFC] Volatile fanotify marks
Date: Fri, 13 May 2022 15:30:41 +0000 [thread overview]
Message-ID: <Yn55ocRH8f83n4RY@google.com> (raw)
In-Reply-To: <20220228140556.ae5rhgqsyzm5djbp@quack3.lan>
On Mon, Feb 28, 2022 at 03:05:56PM +0100, Jan Kara wrote:
> Hi Amir!
>
> On Wed 23-02-22 20:42:37, Amir Goldstein wrote:
> > I wanted to get your feedback on an idea I have been playing with.
> > It started as a poor man's alternative to the old subtree watch problem.
> > For my employer's use case, we are watching the entire filesystem using
> > a filesystem mark, but would like to exclude events on a subtree
> > (i.e. all files underneath .private/).
> >
> > At the moment, those events are filtered in userspace.
> > I had considered adding directory marks with an ignored mask on every
> > event that is received for a directory path under .private/, but that has the
> > undesired side effect of pinning those directory inodes to cache.
> >
> > I have this old fsnotify-volatile branch [1] that I am using for an overlayfs
> > kernel internal fsnotify backend. I wonder what are your thoughts on
> > exposing this functionally to fanotify UAPI (i.e. FAN_MARK_VOLATILE).
>
> Interesting idea. I have some reservations wrt to the implementation (e.g.
> fsnotify_add_mark_list() convention of returning EEXIST when it updated
> mark's mask, or the fact that inode reclaim should now handle freeing of
> mark connector and attached marks - which may get interesting locking wise)
> but they are all fixable.
>
> I'm wondering a bit whether this is really useful enough (and consequently
> whether we will not get another request to extend fanotify API in some
> other way to cater better to some other usecase related to subtree watches
> in the near future). I understand ignore marks are mainly a performance
> optimization and as such allowing inodes to be reclaimed (which means they
> are not used much and hence ignored mark is not very useful anyway) makes
> sense. Thinking about this more, I guess it is useful to improve efficiency
> when you want to implement any userspace event-filtering scheme.
>
> The only remaining pending question I have is whether we should not go
> further and allow event filtering to happen using an eBPF program. That
> would be even more efficient (both in terms of memory and CPU). What do you
> think?
Wait. Did I just read that Jan is open to implementing in kernel event
filtering through eBPF? This feature is something that I'd definitely
be interested in and perhaps also open to running with doing the
design/implementation. One of the really obvious filtering semantics
that immediately comes to mind for me would be to filter on expected
processes/binary images touching an expected set of files. Currently,
this level of filtering has traditionally been done in userspace, but
if we could offload that it'd be nice...
/M
prev parent reply other threads:[~2022-05-13 15:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-23 18:42 [RFC] Volatile fanotify marks Amir Goldstein
2022-02-28 14:05 ` Jan Kara
2022-02-28 17:40 ` Amir Goldstein
2022-03-01 11:07 ` Jan Kara
2022-03-01 11:27 ` Amir Goldstein
2022-03-01 12:26 ` Tycho Kirchner
2022-03-01 16:58 ` Amir Goldstein
2022-03-02 10:04 ` Tycho Kirchner
2022-03-02 18:14 ` Amir Goldstein
2022-03-03 9:24 ` Jan Kara
2022-05-02 9:13 ` Tycho Kirchner
2022-05-04 6:13 ` Amir Goldstein
2022-05-04 10:01 ` Tycho Kirchner
2022-05-04 14:37 ` Amir Goldstein
2022-05-06 9:59 ` Tycho Kirchner
2022-05-05 10:42 ` Jan Kara
2022-05-13 15:30 ` Matthew Bobrowski [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=Yn55ocRH8f83n4RY@google.com \
--to=repnop@google.com \
--cc=amir73il@gmail.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
/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).