Re: [RFC][PATCH 0/7] fanotify: add support for more events

Amir Goldstein
2016-10-11T07:00:05Z

Hi Aleksander,

I dug up this thread from Tracker ml:
https://mail.gnome.org/archives/tracker-list/2011-September/msg00089.html

Linking to this posting on LKML:
https://lkml.org/lkml/2009/3/27/166

Is the Tracker project interested is a solution for efficient
monitoring of entire file system?
If only interested in unprivileged monitoring and/or recursive
directory monitoring,
the work could be extended in this direction (see details below)

Cheers,
Amir.

On Mon, Oct 10, 2016 at 10:12 PM, Amir Goldstein <amir73il@gmail.com> wrote:
> Hi all,
>
> This series is a prep work for using fanotify to monitor all
> events in a file system with a single watch.
>
> The end result is indented to be an alternative to the recursive
> inotify watches scheme, which has its problems.
>
> This first part adds support for most inotify events to fanotify
> when watching a directory.
>

Please note that in my current implementation of directory watch, you
get the directory fd
for create/move/delete events and the filename information is optional
data to event by an opt-in flag to fanotify_init.
Without filename data, those events can be more compact and easily merged,
in case user is only interested in coalesced "something changed here" event.

> The next part will add support for watching a super block,
> which is not the same as watching a mount point.
>

FYI, I also intend to (optionally) replace the fd information with
file handle for a super block watch.
That has a few benefits:
- Avoids the need to take references on path/dentries in the event queue
- Could pave the path to relaxing CAP_ADMIN requirement
- It serves as a replacement the rename cookie (and it persists across
any number of renames)

> I am posting this WIP to get feedback on the idea and to find
> out if there are any users out there interested in the improved
> fanotify capabilities and/or in the super block monitoring
> use case.
>
> Amir Goldstein (7):
> fsnotify: pass dentry instead of inode when available
> fsnotify: annotate filename events
> fanotify: new init flag FAN_EVENT_INFO_PARENT
> fanotify: store mount point from which an inode watch was added
> fanotify: support events with data type FSNOTIFY_EVENT_DENTRY
> fanotify: add support for create/attrib/rename/delete events
> fanotify: pass filename info for filename events
>
> fs/notify/fanotify/fanotify.c | 85 +++++++++++++++++++++++++++++++----
> fs/notify/fanotify/fanotify.h | 24 +++++++++-
> fs/notify/fanotify/fanotify_user.c | 92 ++++++++++++++++++++++++++++++++++----
> fs/notify/fdinfo.c | 4 +-
> fs/notify/fsnotify.c | 2 +-
> fs/notify/inode_mark.c | 1 +
> fs/notify/mark.c | 15 +++++--
> include/linux/fsnotify.h | 46 ++++++++++++++-----
> include/linux/fsnotify_backend.h | 24 +++++++---
> include/uapi/linux/fanotify.h | 41 ++++++++++++++---
> 10 files changed, 287 insertions(+), 47 deletions(-)
>
> --
> 2.7.4
>