Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux: Add support for fanotify when available (running as root) #179

Closed
wants to merge 4 commits into from

Conversation

mat-sz
Copy link

@mat-sz mat-sz commented May 18, 2023

In theory, this should allow for a more efficient way to watch entire filesystems without hitting the watch limits on Linux. I've seen this requested a few times in unrelated issues (mostly VSCode). This only works when running as root.

Let me know if this is something you'd be interested integrating into your project. Lacks unit tests since I'm not sure if this is going to be the final implementation of this.

@mat-sz
Copy link
Author

mat-sz commented May 18, 2023

All the tests are passing locally, running sudo yarn test will result in fanotify_* being used instead of inotify_* on Linux as predicted.

@mat-sz
Copy link
Author

mat-sz commented May 18, 2023

@ianhattendorf Since I believe you might be the maintainer here, could you take a look? Thanks in advance.

@ianhattendorf
Copy link
Contributor

Requiring root is a pretty big limitation. Also, what happens on kernels prior to 5.1? See failing centos test. Since most distributed binaries on Linux will be compiled for the lowest common denominator, it might not make much sense to support this until most applications only support kernel 5.1+.

In particular, there was no support for create, delete, and move events. The support for those events was added in Linux 5.1.

@mat-sz
Copy link
Author

mat-sz commented May 18, 2023

@ianhattendorf

Requiring root is a pretty big limitation.

I'm working on a Linux service that indexes the hard drive, so in this case it's not completely useless. But I agree with you here, 99% of users won't be able to utilize this.

Just wanted to contribute this in case someone else ends up with a similar use case.

Also, what happens on kernels prior to 5.1? See failing centos test. Since most distributed binaries on Linux will be compiled for the lowest common denominator, it might not make much sense to support this until most applications only support kernel 5.1+.

In particular, there was no support for create, delete, and move events. The support for those events was added in Linux 5.1.

I could disable the code paths for kernels that don't support those events. The issue with prebuilt binaries still remains though.

On the other hand, if this isn't something you'd be interested in - I'm going to create a fork with support for this.

@ianhattendorf
Copy link
Contributor

I think a fork would probably be best at this point for such a niche case. Thanks you for checking to see if we would be interested though 👍

@mat-sz mat-sz closed this May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants