[Samba] Locking between GNU/Linux and Microsoft Windows

jra at dp.samba.org jra at dp.samba.org
Wed Feb 12 18:31:06 GMT 2003


On Wed, Feb 12, 2003 at 05:05:21PM +0100, Freddy Spierenburg wrote:
> Hi,
> 
> I'm having some trouble with locking between GNU/Linux and
> Microsoft Windows. I wrote some Clipper code that run's on
> GNU/Linux and Microsoft Windows (compiled to different binaries
> ofcourse) that tries to lock a file on a Samba share.
> 
> Between Microsoft Windows clients there is no problem. The
> locking works as expected. If one client does an EXCLUSIVE lock,
> the other's can't lock the file anymore. The same thing happens
> on multiple GNU/Linux clients. No problem at all.
> 
> The problem is that if a GNU/Linux client locks the file, a
> Microsoft Windows client can still lock the file. It looks to me
> that the locking does not work across the different platforms.
> 
> I do not know much about locking, but from the documentation it
> looks to me that kernel oplocks should be my friend. But
> unfortunately I doesn't seem to work. Does anybody have a hint to
> where I should look?
> 
> The GNU/Linux client is a Red Hat 7.2 (kernel 2.4.7-10smp)
> running Samba version 2.2.1a-4 and the Microsoft Windows clients
> runs Microsoft Windows 2000 Server.

How does Clipper on Linux do locking ? Remember, doing EXCLUSIVE
in Windows Clipper code may use share modes to "lock" a file, not
byte ranges. The Linux kernel has no such concept as share modes,
and so will probably use byte ranges instead.

Try doing an strace to see what happens when your Linux Clipper code
does an "exclusive" open.

Jeremy.


More information about the samba mailing list