Skip to content

RFC fanotify: super block root watch

Amir Goldstein linux-fsdevel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest6 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6fanotify: add a super block root watchfs/notify/fanotify/fanotify.c fs/notify/fanotify/fanotify_user.c include/uapi/linux/fanotify.h+16 -30 replies
2/6fanotify: report events to sb root with fanotify_file_event_infofs/notify/fanotify/fanotify.c fs/notify/fanotify/fanotify.h fs/notify/fanotify/fanotify_user.c+38 -100 replies
3/6fanotify: pass file handle on sb root watcher eventsfs/notify/fanotify/fanotify.c fs/notify/fanotify/fanotify.h fs/notify/fanotify/fanotify_user.c +1 more+102 -330 replies
4/6fanotify: report file name to root inode watch with FS_EVENT_ON_CHILDfs/notify/fanotify/fanotify.c fs/notify/fsnotify.c include/linux/fsnotify_backend.h+35 -70 replies
5/6fanotify: export FAN_ONDIR to userfs/notify/fanotify/fanotify_user.c+6 -10 replies
6/6fanotify: filter events by root mark mount pointfs/notify/fanotify/fanotify.c+11 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC][PATCH 0/6] fanotify: super block root watch

This is the 4th and last part of fanotify super block watch work.

I am posting this last part in preparation to the fsnotify discussion on LSF/MM.

The issue, which this work sets to solve, is the poor scalability of recursive inotify watches.

Other operating systems have a scalable way of watching changes on a large file system. Windows has USN Journal, macOS has FSEvents and BSD has kevents.

Currently, the only way in Linux to monitor file system 'filename events' (e.g. create/delete/move) is the recursive inotify watch way and this method scales very poorly for large enough directory trees. Beyond the exploding probability of a need for full scan, pinning all directory inodes wastes a lot of memory.

The efforts to merge fanotify took several steps in the direction of solving the scalability issue, but they did not go all the way to provide the functionality required to replace inotify.

=== For Reviewers ===

I split the work to 4 parts, which are denoted by 4 branch heads, for convenience of reviewers:

1. A cleanup series with no functional nor performance impact [1][5].

2. Adds the super block root watch functionality to fsnotify infrastructure, without adding user API and without adding support in any backend [2][6].

3. Adds the user API and functionality of reporting 'filename events' (e.g. create/delete/rename) to the fanotify backend [3][7].

4. [This posting] Adds the user API and functionality for reporting all events on a super block via the fanotify backend [4].

The fanotify super block watch feature is currently being tested by my employer and by other interested parties as well.

Adding more tests and possibly writing a dedicated testsuite has been on my TODO list for a while. I have experimented with some options, but not much to show for yet.
In the mean while, I started an fsnotify-TODO wiki [8] and listed some test requirements based on some earlier discussions with Jan.

Comments and thoughts are most welcome.

Thanks!
Amir.

[1] https://github.com/amir73il/linux/commits/fsnotify_dentry
[2] https://github.com/amir73il/linux/commits/fsnotify_sb
[3] https://github.com/amir73il/linux/commits/fanotify_dentry
[4] https://github.com/amir73il/linux/commits/fanotify_sb
[5] http://marc.info/?l=linux-fsdevel&m=148198446127338&w=2
[6] http://marc.info/?l=linux-fsdevel&m=148224725519139&w=2
[7] http://marc.info/?l=linux-fsdevel&m=147612772031987&w=2
[8] https://github.com/amir73il/fsnotify-utils/wiki/fsnotify-TODO

Amir Goldstein (6):
fanotify: add a super block root watch
fanotify: report events to sb root with fanotify_file_event_info
fanotify: pass file handle on sb root watcher events
fanotify: report file name to root inode watch with FS_EVENT_ON_CHILD
fanotify: export FAN_ONDIR to user
fanotify: filter events by root mark mount point

 fs/notify/fanotify/fanotify.c      |  83 ++++++++++++++++++++++++------
 fs/notify/fanotify/fanotify.h      |  40 +++++++++++++--
 fs/notify/fanotify/fanotify_user.c | 102 ++++++++++++++++++++++++++-----------
 fs/notify/fsnotify.c               |  13 +++--
 include/linux/fsnotify_backend.h   |  13 +++++
 include/uapi/linux/fanotify.h      |   7 ++-
 6 files changed, 205 insertions(+), 53 deletions(-)
Signature · 1 line
2.7.4