Superblock watch for fsnotify
At the 2017 Linux Storage, Filesystem, and Memory-Management Summit, Amir Goldstein led a discussion about the fsnotify filesystem notification subsystem and some changes he would like to see. Unfortunately, due to a bit of confusion of where the session would be held, I missed half of it; here's what I can reconstruct from the second half. Fsnotify is the internal kernel support subsystem for all three of the file notification APIs (dnotify, inotify, and fanotify).
Goldstein is trying to make fsnotify more scalable for getting notifications of changes in a large filesystem. To that end, he has proposed a "superblock watch" mechanism to efficiently report all changes made to a filesystem. For his use case, he just needs to be able to receive notifications when any file in any directory in the filesystem has changed (been created, deleted, or moved). There was a question about whether the names of the files that are changed should be included in the event, but Goldstein said he did not need that functionality (though others might); his application simply rescans the directory if anything has changed in it.
Al Viro was concerned that the file names would not stay valid while notifications were being delivered. Jan Kara said that there could be races that would make it hard to reproduce the sequence of changes that were made to the directory. But adding names to the fsnotify events does add significant complexity to the code. There is a clear demand for being able to get notification events on a large directory tree, however, Kara said. For now, he is not convinced that adding file names into the event is warranted and it could lead to various kinds of problems.
Goldstein said that the superblock watch is the simplest approach, rather than having a recursive fanotify watch on the mount point, which does not scale well. That API could eventually be extended to allow the creation of a change journal like NTFS supports, he said. There did not seem to be any fundamental opposition to the superblock watch feature as it stands.
| Index entries for this article | |
|---|---|
| Kernel | fanotify |
| Conference | Storage, Filesystem, and Memory-Management Summit/2017 |
