Re: [RFC][PATCH] fanotify_mark.2: Document FAN_MARK_IGNORE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 6, 2022 at 12:48 PM Jan Kara <jack@xxxxxxx> wrote:
>
> On Sun 04-09-22 18:51:13, Amir Goldstein wrote:
> > A new flavor of FAN_MARK_IGNORED_MASK that helps to resolve the
> > ambiguity around the combination of event flags and ignore mask.
> >
> > It is also more strict in the events and flags allowed to be
> > set in a non-directory inode mark mask and it mandates the use
> > of FAN_MARK_IGNORED_SURV_MODIFY flag on filesystem, mount and
> > directory inode marks.
> >
> > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
>
> <snip>
>
> > +.BR FAN_MARK_IGNORE " (since Linux 6.0)"
> > +.\" commit e252f2ed1c8c6c3884ab5dd34e003ed21f1fe6e0
> > +This flag has a similar effect as setting the
> > +.B FAN_MARK_IGNORED_MASK
> > +flag.
> > +The events in
> > +.I mask
> > +shall be added to or removed from the ignore mask.
> > +Unlike the
> > +.B FAN_MARK_IGNORED_MASK
> > +flag,
> > +this flag also has the effect that the
> > +.B FAN_ONDIR ,
> > +and
> > +.B FAN_EVENT_ON_CHILD
> > +flags take effect on the ignore mask.
> > +Specifically, unless
> > +.B FAN_ONDIR
> > +flag is set with
> > +.BR FAN_MARK_IGNORE ,
> > +events on directories will not be ignored
> > +and if the flag
> > +.B FAN_EVENT_ON_CHILD
> > +is set,
> > +events on children will be ignored.
> > +For example,
> > +a mark on a directory with combination of
> > +a mask with
> > +.B FAN_CREATE
> > +event
> > +and
> > +.B FAN_ONDIR
> > +flag
> > +and an ignore mask with
> > +.B FAN_CREATE
> > +event
> > +and without
> > +.B FAN_ONDIR
> > +flag,
> > +will result in getting only events for creation of sub-directories.
> > +When using this flag to add to an ignore mask
> > +of a mount, filesystem, or directory inode mark,
> > +the
> > +.B FAN_MARK_IGNORED_SURV_MODIFY
> > +flag must be specified.
>
> Perhaps a short rationaly why this flag is required would be good here?

Here is a bit much IMO.
I will add it to the next section.
How's that?

 .B FAN_MARK_IGNORED_SURV_MODIFY
 The ignore mask shall survive modify events.
 If this flag is not set,
 the ignore mask is cleared when a modify event occurs
-for the ignored file or directory.
+on the marked object.
+Omitting this flag is typically used to suppress events
+(e.g.,
+.BR FAN_OPEN )
+for a specific file,
+until that specific file's content has been modified.
+It is far less useful to suppress events
+on an entire filesystem,
+or mount,
+or on all files inside a directory,
+until some file's content has been modified.
+For this reason,
+the
+.B FAN_MARK_IGNORE
+flag requires the
+.B FAN_MARK_IGNORED_SURV_MODIFY
+flag on a mount,
+filesystem,
+or directory inode mark.
+This flag cannot be removed from a mark once set.
+When the ignore mask is updated without this flag,
+on a mark that was previously updated with the
+.B FAN_MARK_IGNORE
+and
+.B FAN_MARK_IGNORED_SURV_MODIFY
+flags,
+the update fails with
+.B EEXIST
+error.
+.TP
+.B FAN_MARK_IGNORE_SURV
+This is a synonym for
+.RB ( FAN_MARK_IGNORE | FAN_MARK_IGNORED_SURV_MODIFY ).
 .TP


>
> > +Failure to do so will results with
> > +.B EINVAL
> > +or
> > +.B EISDIR
> > +error.
>
> <snip>
>
> > +.TP
> > +.B EISDIR
> > +.I flags
> > +contains
> > +.BR FAN_MARK_IGNORE ,
> > +and
> > +.BR FAN_MARK_IGNORED_SURV_MODIFY ,
>
> I think it should rather be "but does not contain
> FAN_MARK_IGNORED_SURV_MODIFY", shouldn't it?
>

Yes. Good catch!

Thanks,
Amir.



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux