Dear Experts,

I'm hoping that your experience with SMB and CIFS means that you're familiar with cross-platform file locking. I need a lowest-common-denominator whole-file locking method that will work on as many combinations of client and server systems as possible; in particular it needs to run on

- Linux client talking to NFS server.
- Linux client talking to Samba server.
- Linux client talking to Windows server.
- Windows client talking to Samba server.
- Windows client talking to Windows server.
- Linux local disk access.
- Windows local disk access.
No doubt each of those combinations has many variations.

I only need advisory locking, not mandatory locking; a lockfile convention would be fine. I'm hoping that something like the algorithm used by liblockfile could be used (see man lockfile_create, e.g. http://pwet.fr/man/linux/fonctions_bibliotheques/lockfile_create). Basically it creates a file with a unique name, links it to the <filename>.lock file, and uses stat() to see if its link got there before any other contender. This is designed to be NFS-safe but I don't know if it would be possible or safe in an SMB or CIFS environment.

I'm sure this must have been solved before but I can't find anything especially helpful; maybe I'm not searching for the right keywords.

If anyone can point me in the right direction I would be very grateful.


Regards,

Phil.




--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba

Reply via email to