fsnotify on mount points

Hi,

Can somebody elaborate on why fsnotify won't watch mount points? a76e670352cac7320b63b78b802924e536953683 introduces this change because of IDEA-94524, so any direct watch under a mount point returns UNWATCHEABLE.

We have a case where we would very much like to watch a network mounted file system, and I'd love to learn more about the considerations so we could perhaps make a more informed decision about what mount points are watchable or not.

8 comments
Comment actions Permalink

Hi Tom,

Because it believes a mounted FS is of a network kind. Is it true for your case?

0
Comment actions Permalink

Yes, it's a network mount point using Google's network files system objfs. objfs seems to support inotify as far as I can tell (inotifywait works at least).

Tangentially, for other kinds of network files systems that don't support inotify (but do support other forms of notifications) we've had to inject a shim fsnotify.

0
Comment actions Permalink

I can add it to the whitelist, just tell me how exactly it reads in /etc/mtab.
Regarding other FSes... well, it there is a library covering inotify and other notifiers I'd gladly use it.

0
Comment actions Permalink

What information in particular are you looking for from /etc/mtab?

0
Comment actions Permalink

I did a little more spelunking and saw that fsnotifier is filtering on a few things, including the type of the mount and this is likely filtering us out. What would be a good approach to prevent this? I can think of two ways off the top of my head: allowing us to pass permissible types in to fsnotify or allowing adding our specific file system in the checks. I think the former is better because it isn't specific to our exact case.

What do you suggest to do?

0
Comment actions Permalink

We recently merged a pull request from one of your colleagues that allows to provide pluggable FileWatcher implementations: https://github.com/JetBrains/intellij-community/pull/292

Maybe you can synchronize with him and find a way to use a common FileWatcher implementation for all use cases of IntelliJ IDEA inside Google?

0
Comment actions Permalink

Right, fsnotifier blacklists entries based on a mount type (3rd column in /etc/mtab file). If your FS does support inotify and has a chance to occur outside Google walls, it is better to hard-code it in the filter. Otherwise, I'd propose using an extension point to FileWatcher class (like Dmitry have suggested above).

0
Comment actions Permalink

Thanks for the info. We are working closely with Dmitry L., so we have a good understanding of the PluggableFileWatcher. It sounds like the right approach for us will be to make a new pluggable file watcher and handle our case specifically. That way there aren't special cases in the generic file watcher code and we can be in control in case something changes in the future. Thanks again for the responses.

0

Please sign in to leave a comment.