Freddy Spierenburg
2003-Feb-12 16:05 UTC
[Samba] Locking between GNU/Linux and Microsoft Windows
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. $ testparm|grep locks kernel oplocks = Yes blocking locks = Yes fake oplocks = No oplocks = Yes level2 oplocks = Yes $ -- $ cat ~/.signature Freddy Spierenburg <freddy@dusktilldawn.nl> http://snarl.nl/~freddy/ GnuPG: 0x7941D1E1=C948 5851 26D2 FA5C 39F1 E588 6F17 FD5D 7941 D1E1 $ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.samba.org/archive/samba/attachments/20030212/9e593ad1/attachment.bin
jra@dp.samba.org
2003-Feb-12 18:31 UTC
[Samba] Locking between GNU/Linux and Microsoft Windows
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.