Re: Is this a fanotify_init() bug manifesting in fanotify_mark()?

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

 



Hi!

I was going through some old email and noticed this question. Probably
you've already figured out yourself but just in case:

On Tue 02-04-24 20:27:03, Josh Marshall wrote:
> I am making an event driven free space monitoring utility.  The core
> idea of the design is to use fanotify to listen for the existence of
> events which can increase space consumption, and when this happens
> check the remaining free space.  Extra functionality to make this not
> face meltingly stupid are planned before I suggest anyone use it,
> don't worry.
> 
> I am using the documentation here:
> https://man7.org/linux/man-pages/man7/fanotify.7.html
> https://man7.org/linux/man-pages/man2/fanotify_init.2.html
> https://man7.org/linux/man-pages/man2/fanotify_mark.2.html
> 
> ```Causes problem
>   int f_notify = fanotify_init(FAN_CLASS_NOTIF, 0);
> ```
> ```No problem
>   int f_notify = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);
> ```
> ```Where it manifests
>   if( fanotify_mark(f_notify, FAN_MARK_ADD | FAN_MARK_ONLYDIR,
> FAN_CREATE , AT_FDCWD, mnt) == -1 ){...}
> ```

FAN_CREATE event is so called directory event and as such it requires the
notification group to be in "FID mode" - i.e., reporting fsid + fhandle
instead of open file descriptor to file generating the event. So you need
at least FAN_REPORT_FID flag to fanotify_init(2) to be able to use
FAN_CREATE event.

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux