I have the following problem:
I have an app ( Win + Mac ) that stays connected to a samba share ( concurrent access ).
The purpose is to lock a directory( shared ) for exclusive access by creating an empty lock file.
The lock file is created with open(...) using the _O_CREAT and _O_EXCL flags.
Using _O_EXCL I am guaranteed ( at least I thought so ) that open returns an error if the file already exists.
The problem is ( I haven't been able to prove it yet ) that open returns a valid file descriptor sometimes when both clients try to create the lock file simultaneously. The result is not good - both clients think that they have created the lock file and tehrefore have exclusive access on that folder.
Has anyone else encountered this? Or, does anyone sees a problem in this exclusive access mechanism?
As usually, any suggestion is welcome.
Regards,
Marcel.
Bookmarks