Subject: bug#13540: 24.3.50; Regression in trunk: auto-revert-mode fails on files accessed via samba

From: Eli Zaretskii <[email-masked]>
Date: Thu, 24 Jan 2013 18:32:18 +0200

> From: Michael Albinus <[email-masked]>
> Date: Thu, 24 Jan 2013 11:13:52 +0100
> Cc: [email-masked]
> 
> Likely, it is not possible to enable file notifications for mounted file
> systems under Windows. In that case, `w32notify-add-watch' shall return
> nil, and the code in auto-revert.el shall fall back to the previous
> implementation.

Actually, both w32notify-add-watch and inotify-add-watch signal an
error in that case.  It's auto-revert that catches the error with
ignore-errors and converts that to nil.  I guess we need to update the
doc strings.

Anyway, w32notify does support mounted filesystems, as long as the
server that does the mounting supports the ReadDirectoryChangesW API
which w32notify uses.  Googling suggests that Samba has problems in
this area, see, for example this page:

  http://qualapps.blogspot.co.il/2010/05/understanding-readdirectorychangesw_19.html

(which btw was a great source of information for me while I worked on
w32notify.c).  It says:

   Network Drives

   ReadDirectoryChangesW works with network drives, but only if the
   remote server supports the functionality. Drives shared from other
   Windows-based computers will correctly generate notifications. Samba
   servers may or may not generate notifications, depending on whether
   the underlying operating system supports the functionality. Network
   Attached Storage (NAS) devices usually run Linux, so won't support
   notifications. High-end SANs are anybody's guess.

It could be that the API we use does not fail, but the notifications
simply don't come in from that volume.  I asked Dani to report if
there's any sign of trouble when the watch is installed.  Depending on
the findings, we may or may not be able to detect the problem
automatically and fall back to the old method.

Failing that, I guess we will have to introduce more elaborate
customizations that would allow users to specify filesystems that
should or should not use file notifications.  (Doesn't inotify have
similar issues with NFS-mounted volumes?)