Re: [PATCH] fsnotify: Extend ioctl to allow to suppress events

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

 



On Fri, Sep 17, 2021 at 3:05 PM Sheng Yong <shengyong2021@xxxxxxxxx> wrote:
>
> Hi, Honza,
>
> On 2021/9/17 16:49, Jan Kara wrote:
> > On Thu 16-09-21 22:06:49, Sheng Yong wrote:
> >> This patch adds a new ioctl cmd INOTIFY_IOC_SUPRESS to stop queueing
> >> events temporarily. A second ioctl could resume queueing events again.
> >> With it enabled, we could easily suppress events instead of updating
> >> or removing watches, especially if we have losts of watches referring
> >> to one inotify instance, for example watching a directory recursively.
> >>
> >> Signed-off-by: Sheng Yong <shengyong2021@xxxxxxxxx>
> >
> > Thanks for the patch! This ioctl on its own is equivalent to shutting down
> > the notification group so I don't think it is really useful on its own.
>
> Thanks for your reply.
> Yes, this ioctl reuses the stop-queueing-events procedure of shutdown.
>
> > If you add ioctl to resume queueing, it makes some sense but can you
> > ellaborate a bit more why you need to stop receiving events temporarily?
>
> The usecase is that we use rsync+inotify to backup files. Let's say there are
> two tasks: 1) "real-time" task reads events and syncs the file; 2) periodic
> task syncs all files recursively in the source directory.
>
> If the queue get overflowed and new events are discarded, we have to start a
> recursive sync. But recursive sync takes a very long time to scan, compare and
> transmit data, we prefer a periodic task to do that, so that we could ignore
> overflow events.
>
> When the periodic task is working, I think the "real-time" task should stop
> reading and handling new events temporarily to avoid duplicated IO in both
> sides. I think stop queueing new events is the easiest way to do that.
>

Having some experience with similar applications, I have highs doubts about
this models. Anyway, you should be able to achieve better results with fanotify
by adding an FAN_MARK_FILESYSTEM mark with ignored mask or by using
a FAN_MARK_FILESYSTEM instead of recursive inotify to begin with.
See: https://github.com/inotify-tools/inotify-tools/pull/134

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