Getting File Create Notifications for CIFS Mount in Linux

我的梦境 提交于 2019-12-01 02:48:10

I have also been working on this and ran into the same issue - it seems (after a little trawling on google) that, unfortunately, it is not possible to use inotify on CIFS mounted partitions - The following was in a redhat forum post from a couple of years ago:

"Currently, no this isn't possible with CIFS. The VFS hooks to allow a filesystem to set up extra notfications were removed recently. The only "user" of them was CIFS and it never worked properly anyway. The kernel interface for this had serious problems too.

I think Steve has plans to reimplement it, but it's a major project that means adding new functionality to the VFS layer of the kernel."

While this was a couple of years ago, it seems we are no closer to having this facility available - shame, I could have really used it too!

I too ran into this and reached the same conclusion as Stephen Sullivan (CIFS + inotify = no go).

However, since my workflow happened to depend on both remote mounts and auto-compile tools that rely on inotify, I ended up building a (fairly desperate & hacky) solution which basically just uses polling to watch for changes and then touches the same files again on the mounted side, which does seem to fire off inotify events. It is not my proudest moment.

Having said that, it does work, so, enjoy: http://github.com/rubyruy/watchntouch

It can be done.. sort of

If you set up an webdav server and include the share as webdav location, you can monitor the location on you samba server while accessing it through webdav from your windows machine.

The big problem with this is that file permissions are a b*tch... as usual with apache2 webdav since its missing pass-through authentication

For Windows hosts running Linux docker containers there is a detailed article on t his issue with a provided solution that works "docker-windows-volume-watcher": http://blog.subjectify.us/miscellaneous/2017/04/24/docker-for-windows-watch-bindings.html

Looks like support is not coming any time soon from Linux implementation of CIFS inotify.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!