On Thu, Aug 1, 2024 at 7:09 PM Jan Kara <jack@xxxxxxx> wrote: > > On Thu 25-07-24 14:19:42, Josef Bacik wrote: > > From: Amir Goldstein <amir73il@xxxxxxxxx> > > > > Generate FAN_PRE_MODIFY permission event from fsnotify_file_perm() > > pre-write hook to notify fanotify listeners on an intent to make > > modification to a file. > > > > Like FAN_PRE_ACCESS, it is only allowed with FAN_CLASS_PRE_CONTENT > > and unlike FAN_MODIFY, it is only allowed on regular files. > > > > Like FAN_PRE_ACCESS, it is generated without sb_start_write() held, > > so it is safe for to perform filesystem modifications in the the > ^^^ seems superfluous ^^^ twice "the" > > > context of event handler. > ... > > diff --git a/include/linux/fanotify.h b/include/linux/fanotify.h > > index 5c811baf44d2..ae6cb2688d52 100644 > > --- a/include/linux/fanotify.h > > +++ b/include/linux/fanotify.h > > @@ -92,7 +92,8 @@ > > #define FANOTIFY_CONTENT_PERM_EVENTS (FAN_OPEN_PERM | FAN_OPEN_EXEC_PERM | \ > > FAN_ACCESS_PERM) > > /* Pre-content events can be used to fill file content */ > > -#define FANOTIFY_PRE_CONTENT_EVENTS (FAN_PRE_ACCESS) > > +#define FANOTIFY_PRE_CONTENT_EVENTS (FAN_PRE_ACCESS | FAN_PRE_MODIFY) > > +#define FANOTIFY_PRE_MODIFY_EVENTS (FAN_PRE_MODIFY) > > I didn't find FANOTIFY_PRE_MODIFY_EVENTS used anywhere? Right. It is used later in the sb_write_barrier patches. We can introduce it later if you prefer. Thanks, Amir.