<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2015-07-28 19:20 GMT+02:00 Simon McVittie <span dir="ltr"><<a href="mailto:simon.mcvittie@collabora.co.uk" target="_blank">simon.mcvittie@collabora.co.uk</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 28/07/15 17:28, Mantas Mikulėnas wrote:<br>
> At first look, this seems very similar to FAM (which even supported<br>
> NFSv3, using custom notifications over SunRPC).<br>
><br>
> Later I remember GNOME replaced it with Gamin and finally with<br>
> local-only inotify inside glib/gvfs.</span></blockquote><div><br></div><div>No, what I propose is a fs notify change daemon which is able to forward a watch to individual filesystems, </div><div>and can listen to events coming from these filesystems from the backend.</div><div><br></div><div>Gamin can't do that. It's not maintained anymore and difficult to understand.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
</span>What GLib actually uses is an abstraction with multiple backends,<br>
including inotify (the default on Linux) and FAM; so in principle it<br>
could have a backend for some new thing, or even use inotify for "normal<br>
local filesystems" and the new backend for other mounts.<br></blockquote><div><br></div><div>I'm afraid I do not understand you here.</div><div> </div><div>>> - the FUSE kernel module in VFS has to trigger fsnotify call when</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
>> events are pushed to the VFS by the userspace daemon.<br>
<br>
</span>If you're adding a monitoring/notification call to FUSE, would it be out<br>
of the question for the user-space API to it to be exactly "use<br>
inotify"? (Or fanotify, or whatever is believed to be the right<br>
user-space API for file monitoring these days.)<br></blockquote><div><br></div><div>I've written that I've tried this, and also that I stopped this idea, cause it's not the way to go.</div><div>But for your understanding, the underlying subsystem is fsnotify, and it does handle inotify and/or fanotify, whatever is used.</div><div>So userspace should use the fsnotify api.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span><br>
>> It should also be able to "forward" a watch to a filesystem like<br>
>> FUSE and cifs and nfs, so that they "know" a watch has been set.<br>
>> They can act then on it, by forwarding the watch to the backend. SMB<br>
>> does upport this, NFS4 also, and you can make FUSE also support<br>
>> it(depending the protocol).<br>
<br>
</span>If the in-kernel implementation of NFS or CIFS isn't enhanced to support<br>
monitoring, this can't work.<br></blockquote><div><br></div><div>At this moment this can't work, but for CIFS in the past it worked (with dnotiify). See:</div><div><br></div><div>See line 6459 in cifssmb.c in /fs/cifs in the kernel. It is disabled for now.</div><div>But support in SMB (SMB servers do support it).</div><div><br></div><div>I know that the NFS4 protocol also supports it.</div><div><br></div><div>You must understand that the protocols do support it, but it does not work with Linux, cause</div><div>nobody has tried it yet, and fsnotify does not let the individual filesystems know that there is a watch set.</div><div><br></div><div>There are network filesystems/protocols like webdav which do not support the setting of a watch and getting </div><div>fsevents from the backend. Webdav is build upon HTTP, and the current version does not support the pushing of events </div><div>from the server to the client. We have to wait for version 2 of the HTTP protocol, as the main developer of the webdav proto </div><div>told me Joe Orton.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
If the in-kernel implementation of NFS or CIFS *is* enhanced to support<br>
monitoring, is there any reason for the kernel not to present the<br>
resulting information to user-space via inotify? In other words, is<br>
there a reason why a user-space service is necessary?<br></blockquote><div><br></div><div>Like I mentioned in the first post and here again, the filesystems like FUSE, NFS and CIFS (and other)</div><div>are not "contacted" by fsnotify about a watch. This is by design.</div><div><br></div><div>So if the kernel does not do this (and beleive me there are good reasons for), you have to do this in userspace.</div><div><br></div><div>Stef Bon</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
(I realise that one possible reason for a user-space service is so that<br>
it can aggregate all the periodic polling, on filesystems that don't<br>
have anything better you can do - that's why FAM had a daemon, if I<br>
remember correctly.)<br></blockquote><div><br></div><div>Yes that's one reason.  But there are more reasons to do this in userspace, see above.</div><div><br></div><div>Stef</div><div><br></div></div></div></div>