Re: Mounted cifs share and repeat=watch bidirectional sync

Greg Troxel <[email protected]> Thu, 09 Jan 2025 07:14:16 -0500
Newsgroups gmane.network.unison.general
Message-ID <[email protected]>
Tõivo Leedjärv <[email protected]> writes:

> You haven't mentioned the system you're on, so I'm going to assume Linux,
> which uses inotify to watch for filesystem changes. You can try an external
> utility like inotifywatch or inotifywait to see if changes on the other
> root are detected or not. A very quick and shallow search shows that
> inotify does not work on cifs.

unison is open to multiple fsmonitor implementations, so if Laurent can
write a program using some other mechanism that detects changes, it
should be a small matter of programming to hook it up.

More seriously, I don't understand how this could work.  Mechanisms like
inotify are about the operating system kernel, which is mediating all
file access, sending a message to a registered client when there is a
change.

With a CIFS mount, the actual files are across the network.   I am
unclear if Laurent is only wanting a notification if those files are
modified from the same host unison is running on, or also if they are
modified by the machine hosting the files or some other CIFS clients.

To learn about changes from off machine writers, CIFS would have
to basically implement an inotify-like mechanisms at the CIFS level, so
that the request to watch could be relayed to the fileserver, and
notifications sent back.

I am only aware of this happening in a remote filesystem in the context
of caching.   Coda can obtain an exclusive lock or a read lock for a
file from the server, and then the server will try to call in the lock
if some other client tries to get a lock.   But, obtaining read locks on
every file in your tree just because you want sync notification is
likely to be too much.

I think NFSv4 might have something a little bit like this, but I'm
unclear on the details.

Tõivo's suggestion to use an inotify test tool sounds exactly right to
me.  I always lean to splitting a complex system into pieces and to test
at boundaries.  If the OS doesn't deliver inotify messages, fsmonitor
doesn't have a chance.

Checking every hour sounds reasonable.  Checking every 60s would likely
result in a large amount of network traffic.


Another possibility is to use unison over ssh where the remote unison is
on the machine with the data and can use a watcher.  I'd say this even
if I lean to "try not to use CIFS, ever, and try to avoid using remote
file systems when reasonable" :-).




To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].