From: Amir Goldstein <amir73il@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: Christian Brauner <brauner@kernel.org>, linux-fsdevel@vger.kernel.org
Subject: Re: [RFC PATCH v2 0/3] fanotify HSM events for directories
Date: Sat, 14 Jun 2025 19:03:42 +0200 [thread overview]
Message-ID: <CAOQ4uxhxsmWC75yg09kjTzCy8dAGNe90SC_aX9rgNivepzTyCA@mail.gmail.com> (raw)
In-Reply-To: <CAOQ4uxg1k7DZazPDRuRfhnHmps_Oc8mmb1cy55eH-gzB9zwyjw@mail.gmail.com>
On Tue, Jun 10, 2025 at 5:25 PM Amir Goldstein <amir73il@gmail.com> wrote:
>
> On Tue, Jun 10, 2025 at 3:49 PM Jan Kara <jack@suse.cz> wrote:
> >
> > Hi Amir!
> >
>
> Hi Jan!
>
> Thanks for taking the time to read my long email ;)
>
> > On Wed 04-06-25 18:09:15, Amir Goldstein wrote:
> > > In v1 there was only patch 1 [1] to allow FAN_PRE_ACCESS events
> > > on readdir (with FAN_ONDIR).
> > >
> > > Following your feedback on v1, v2 adds support for FAN_PATH_ACCESS
> > > event so that a non-populated directory could be populted either on
> > > first readdir or on first lookup.
> >
> > OK, it's good that now we have a bit more wider context for the discussion
> > :). First, when reading this I've started wondering whether we need both
> > FAN_PRE_ACCESS on directories and FAN_PATH_ACCESS (only on directories).
> > Firstly, I don't love adding more use to the FAN_ONDIR flag when creating
> > marks because you can only specify you want FAN_PRE_ACCESS on files,
> > FAN_PRE_ACCESS on files & dirs but there's no way to tell you care only
> > about FAN_PRE_ACCESS on dirs. You have to filter that when receiving
> > events. Secondly, the distinction between FAN_PRE_ACCESS and
> > FAN_PATH_ACCESS is somewhat weak - it's kind of similar to the situation
> > with regular files when we notify about access to the whole file vs only to
> > a specific range. So what if we had an event like FAN_PRE_DIR_ACCESS that
> > would report looked up name on lookup and nothing on readdir meaning you
> > need to fetch everything?
> >
>
> This makes a lot of sense to me. and I also like the suggested event name.
> Another advantage is that FAN_PRE_ACCESS can always expect a range
> (as documented)
>
Hi Jan,
I started looking at combining readdir() and lookup() to generate
FAN_PRE_DIR_ACCESS and I hit this problem:
Currently, FAN_PRE_ACCESS is an event that is FS_EVENTS_POSS_ON_CHILD,
so watching a parent with FAN_EVENT_ON_CHILD can report this event
on files.
The same is true for FAN_OPEN, FAN_ACCESS and FAN_OPEN_PERM events,
but in that case, also true for an opened/access directory.
I do not think it is right to generate pre-content lookup events in
subdir when watching
a parent directory. I don't think that generating pre-content readdir
events on subdir
when watching a parent dir is very useful, but if you do not allow
that, we deviate
from the behavior of the event FAN_ACCESS | FAN_ONDIR which also happens
on readdir.
Honestly, I always found it a bit confusing that when reporting DFID_NAME of
events FAN_OPEN | FAN_ONDIR and FAN_ACCESS | FAN_ONDIR, when
watching the parent, we do not report the name of the subdir (like
inotify does),
but I still think it was the right thing to do.
Do you understand my dilemma?
Do you think it is fine for FAN_PRE_DIR_ACCESS to break out of this
confusing pattern and not be reported for subdirs on a watches parent?
Do you think we should report pre-content lookup events in subdir
with a watched parent?
Do you have an idea how to make this less confusing to users?
Or should we drop the idea of unifying the readdir/lookup events
and keep the legacy semantics for pre-readdir.
Thanks,
Amir.
next prev parent reply other threads:[~2025-06-14 17:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-04 16:09 [RFC PATCH v2 0/3] fanotify HSM events for directories Amir Goldstein
2025-06-04 16:09 ` [RFC PATCH v2 1/3] fanotify: allow creating FAN_PRE_ACCESS events on directories Amir Goldstein
2025-06-04 16:09 ` [RFC PATCH v2 2/3] fanotify: allow O_PATH flag in event_f_flags Amir Goldstein
2025-06-04 16:09 ` [RFC PATCH v2 3/3] fanotify: introduce FAN_PATH_ACCESS event Amir Goldstein
2025-06-04 16:35 ` [RFC PATCH v2 0/3] fanotify HSM events for directories Amir Goldstein
2025-06-10 13:49 ` Jan Kara
2025-06-10 15:25 ` Amir Goldstein
2025-06-14 17:03 ` Amir Goldstein [this message]
2025-06-16 9:07 ` Jan Kara
2025-06-16 17:00 ` Amir Goldstein
2025-06-17 9:43 ` Jan Kara
2025-07-03 19:14 ` Amir Goldstein
2025-07-04 9:24 ` Jan Kara
2025-07-04 10:58 ` Amir Goldstein
2025-07-08 15:32 ` Amir Goldstein
2025-07-09 9:00 ` Amir Goldstein
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=CAOQ4uxhxsmWC75yg09kjTzCy8dAGNe90SC_aX9rgNivepzTyCA@mail.gmail.com \
--to=amir73il@gmail.com \
--cc=brauner@kernel.org \
--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).