Re: Fanotify events on the same file path

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

 



On Sun, Sep 4, 2022 at 5:10 PM Gal Rosen <gal.rosen@xxxxxxxxxxxxxx> wrote:
>
> Hi Amir,
>
> And what about other events like FAN_CLOSE_WRITE ?

Permission events (e.g. FAN_OPEN_PERM) are never merged in the kernel queue.
FAN_CLOSE_WRITE is an async event, so it MAY be merged with other async
events (such as FAN_OPEN or another FAN_CLOSE_WRITE) on the same
path/object, but:
1. You have no guarantee that the kernel will merge events
2. Kernel will only merge events if all other info except the event mask
    is identical.

So for example, the file was opened by two different threads,
event->pid would be different so the two events would not be
merged.

>
> So, if I understand correctly, it is my responsibility to verify for multiplications
> of file events for the same file path before calling to scan. right ?
>

Right.
Since your application has a queue of its own, you are responsible to
do that anyway, because once you read a FAN_CLOSE_WRITE
event from the kernel and place it in the application queue, the
kernel will surely generate another FAN_CLOSE_WRITE event on
the next file close.

Thanks,
Amir.



[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