file locking between win and linux clients

David Collier-Brown David.Collier-Brown at Sun.COM
Thu Feb 24 15:54:25 GMT 2005


 Alas, this is something of a long-standing problem. On Linux and
SGI, with kernel oplock support, this is much reduced.
 The workaround for other Unixes is to use a unix smb client to 
update the file, which tends to avoid file-overwrite due to local caching...
 Some of the NFSv4 implementors were discussing this on the samba-technical
(development) list the other week...

--dave


Volker Schurig wrote:
> Dear All,
> 
> Description:
> 
> File locking between linux (NFS) clients runs well, file locking between 
> win-clients (SAMBA) runs well, too.
> 
> When a linux client has opend a file and the win client tries to open 
> this file, too,  then the win client is
> NOT able to open the file READABLE - that's not fine but it's acceptable.
> 
> When a win client has opened a file and the linux client tries to open 
> this file, too,  then the linux client
> can read AND WRITE the file. After the access to the file by the linux 
> client the win client is not
> able to write on HIS file further more - that's no so fine.
> 
> Entries in the /proc/locks:
> 
> When the linux client opens the file, an additional WRITE entry appears.
> When the win client opens the file, an additional READ entry appears.
> 
> In the log.smbd I found a corresponding (type = READ) entry of the posix 
> locking system:
> ...
> [2004/12/10 12:15:49, 10] locking/posix.c:is_posix_locked(697)
>  is_posix_locked: File test2.sxw, offset = 0, count = 4096, type = READ
> [2004/12/10 12:15:49, 10] locking/posix.c:posix_lock_in_range(633)
>  posix_lock_in_range: offset_out = 0, count_out = 4096
> ...
> 
> I'm neither a posix nor locking expert but I'm astonished that obviously
> the Samba server uses ONLY a read access on the linux system to access a 
> file?!
> 
> Thanks for your help!
> 
> Volker
> 
> 
> Additional information:
> ================
> 
> Server: OS: Suse 9.1, Samba: 3.0.2a-51
> Clients: Suse 8.1, Windows 2000
> 
> Application: StarOffice (win), OpenOffice (linux)
> 
> smb.conf:
> ------------
> [global]
>    workgroup =test
>    interfaces = 127.0.0.1 eth0
>    bind interfaces only = true
>    printing = cups
>    printcap name = cups
>    printer admin = @ntadmin, root, administrator
>    map to guest = Bad User
> 
>    oplocks = no
>    level2 oplocks = No
>    kernel oplocks = no
>    blocking locks = No
> 
>    log level = 10
> 
>    locking = yes
>    strict locking = yes
>    posix locking = yes
>    readonly = no
> 
> [test]
>    comment = All users
>    path = /home/test
>    writeable = Yes
>    public = yes
> 
> 
> 

-- 
David Collier-Brown,      | Always do right. This will gratify
Sun Microsystems, Toronto | some people and astonish the rest
davecb at canada.sun.com     |                      -- Mark Twain


More information about the samba-technical mailing list