[Samba] Samba and .NET FileSystemWatcher

Volker Lendecke Volker.Lendecke at SerNet.DE
Fri Jun 17 05:26:18 MDT 2011


On Thu, Jun 16, 2011 at 02:59:20PM +0100, Keith Douglas wrote:
> I've been looking into a problem using the .NET FileSystemWatcher class
> in a VB application. The application is only receiving notifications for
> events in the root of the directory it is watching. E.g. When monitoring
> \\SambaServer\Files <file:///\\SambaServer\Files>
> \\SambaServer\Files\file.txt <file:///\\SambaServer\Files\file.txt>
> will give notifications but not \\SambaServer\Files\Folder\file2.txt via
> Samba. 
> 
> The same application works fine using a windows CIFS/SMB share or a
> local drive. 
> 
> The FileSystemWatcher.IncludeSubdirectories option is set to True in the
> application.
> 
>  
> 
> The issue appears to be that Samba does not monitoring file events
> recursively, because inotify in the linux kernel does not monitor
> directories recursively.
> 
>  
> 
> >From man inotify;
> 
> "Inotify  monitoring  of directories is not recursive: to monitor
> subdirectories under a directory, additional watches must be created."
>  
> I was wondering if there is any method by which Samba can notify for
> recursive events? 
> I am aware that this could also be achieved by adding individual watches
> within the afore-mentioned VB application, however this is not an option
> for me at present.

For events that are generated locally on the Linux box or
via other protocols like NFS we have to rely on the
functionality provided by Linux as such, so we are limited
by inotify. Imagine a huge directory tree with thousands of
subdirectories. We just can't put inotify listeners on all
of those.

However, recursive notifies should work for all events that
come in via other cifs clients.

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen


More information about the samba mailing list