On Tue, 12 Nov 2024 at 15:41, Amir Goldstein <amir73il@xxxxxxxxx> wrote: > > You wrote it should be called "in the open path" - that is ambiguous. > pre-content hook must be called without sb_writers held, so current > (in linux-next) location of fsnotify_open_perm() is not good in case of > O_CREATE flag, so I am not sure where a good location is. > Easier is to drop this patch. Dropping that patch obviously removes my objection. But since none of the whole "return errors" is valid with a truncate or a new file creation anyway, isn't the whole thing kind of moot? I guess do_open() could do it, but only inside a if (!error && !do_truncate && !(file->f_mode & FMODE_CREATED)) error = fsnotify_opened_old(file); kind of thing. With a big comment about how this is a pre-read hook, and not relevant for a new file or a truncate event since then it's always empty anyway. But hey, if you don't absolutely need it in the first place, not having it is *MUCH* preferable. It sounds like the whole point was to catch reads - not opens. So then you should catch it at read() time, not at open() time. Linus