Add fanotify support #114
Comments
nathany
added the
platform
label
Jan 21, 2016
|
That would be great. The only thing is, how does someone using Linux choose between them? We may need something along the lines of #104 first. |
purpleidea
commented
Jan 21, 2016
|
Just wanted to get the approximate ACK, so that I can point people here if they're interested in fanotify benefits. Thanks! |
purpleidea
referenced
this issue
in purpleidea/mgmt
Feb 15, 2016
Closed
file resource needs improvements #13
|
@purpleidea I think it would be best to build fanotify Go wrapper out as a separate repo and then look at integrating after that. |
|
@amir73il is working on a "super block watch" for Linux, providing "the ability to set a single (fanotify) watch on a root directory and get notified on all the legacy inotify events without the need to recursively add watches on all directories." https://lkml.org/lkml/2016/12/20/312 This could avoid the need for a user-space recursive watcher (#16) on modern Linux kernels. |
purpleidea
commented
Jan 31, 2017
amir73il
commented
Jan 31, 2017
|
Well the patches are out there already in my github (applied to kernel 4.9), but for those of you hoping for this functionality to get upstream, I suggest to be patient. I have no doubt it is going to be some time before this feature can be This is were you guys can be of help. When promoting a feature for upstream it is important to bring solid use cases that require the feature and argue that the same cannot be achieved by user library code and existing kernel functionality. However, if you can't test my work on a distro kernel then it is going to be harder to claim that it is beneficial for your use cases. I cannot guaranty when I will get to providing this level of installation though, so if there are any of you out there not afraid of building a custom kernel, I will gladly assist you if you want to test my patches. Cheers. |
|
Thanks Amir. Perhaps another option to make the patched kernel available would be to maintain a Vagrant box built with Packer. That way we could test fanotify super block using a VirtualBox VM from any operating system. |
amir73il
commented
Jan 31, 2017
|
Yes, that could work. And I promise to assist the person who volunteers to work on this setup. |
tiwaana
commented
Jan 31, 2017
|
Amir, which kernel version you would like to target ? |
purpleidea
commented
Jan 31, 2017
|
@amir73il I have pinged some kernel engineers at my company to look into your patch. In the meantime, if you have a moment, could you look into and recommend an algorithm or suggest an improvement to the recursive file watching which I've implemented for mgmt? The code is available here: Cheers! |
amir73il
commented
Feb 1, 2017
|
@tiwaana question is moot. I would like to target the earliest kernel version possible, but since this is not a bug fix nor a trivial improvement, some things have to happen first not all of them depend on me, not necessarily in that order:
|
amir73il
commented
Feb 1, 2017
|
@purpleidea thanks for the ping. If your company will show interest in the super block watch, that can be a game changer. wrt your recursive watcher, I am new to golang and have zero knowledge about fsnotify library, but it appears your code is not calling addSubFolders() recursively from Init() more than 1 level of depth, so if you never get events on the direct sub folders you will never add watchers for level 2 subdirs, but I may be missing something. Also I don't see any handling of Move events for dirs, unless it is handled in lib by generating Rename/Create event pair. |
purpleidea
commented
Feb 1, 2017
|
On Wed, Feb 1, 2017 at 3:26 AM, Amir Goldstein ***@***.***> wrote:
@purpleidea thanks for the ping. If your company will show interest in the super block watch, that can be a game changer. wrt your recursive watcher, I am new to golang and have zero knowledge about fsnotify library, but it appears your code is not calling addSubFolders() recursively from Init() more than 1 level of depth, so if you never get events on the direct sub folders you will never add watchers for level 2 subdirs, but I may be missing something. Also I don't see any handling of Move events for dirs, unless it is handled in lib by generating Rename/Create event pair.
I think I am having an algorithmic mind block, as IIRC I think some
cases didn't work all the time. In any case, golang is very similar to
C if you get bored :)
|
isage
commented
Apr 17, 2017
You do know, that fanotify supports recursive watch on (any, even bind) mountpoint with FAN_MARK_MOUNT, right? |
amir73il
commented
Apr 17, 2017
|
@isage focus on the part 'all the legacy inotify event', namely, create/move/delete. |
purpleidea commentedJan 20, 2016
Would there be any objections if someone sent in patches to add support for fanotify?