Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Samba] file locking options in smb.conf

2,019 views
Skip to first unread message

Anoop P.A.

unread,
May 5, 2009, 6:20:17 AM5/5/09
to
Hi List,



I have a file server which runs samba-3.0.28a. My aim is to share a logical volume ( with XFS filesystem) using SAMBA, NFS and FTP. Since it is a file server I’m very much concerned about file locking. After googling and reading a lot I had set file locking flags in smb.conf



lock directory = /var/lock/samba

strict locking = no

locking = yes

level2 oplocks = no

kernel oplocks = yes

oplocks = yes



But still I am having lots of problems in file locking. Following conditions are not working as expected



CIFS(linux) --> CIFS(windows)

NFS --> CIFS

CIFS --> FTP

How ever CIFS(windows) --> CIFS ( windows) locking working as expected.





Can any one suggest best suitable combination file locking parameters for me?



Thanks & Regards,

Anoop P A



Volker Lendecke

unread,
May 5, 2009, 6:40:08 AM5/5/09
to
On Tue, May 05, 2009 at 02:42:57AM -0700, Anoop P.A. wrote:
> Hi List,
>
>
>
> I have a file server which runs samba-3.0.28a. My aim is to share a logical volume ( with XFS filesystem) using SAMBA, NFS and FTP. Since it is a file server I’m very much concerned about file locking. After googling and reading a lot I had set file locking flags in smb.conf
>
>
>
> lock directory = /var/lock/samba
>
> strict locking = no
>
> locking = yes
>
> level2 oplocks = no
>
> kernel oplocks = yes
>
> oplocks = yes
>
>
>
> But still I am having lots of problems in file locking. Following conditions are not working as expected

Question: What do you expect with which applications?

Volker

Anoop P.A.

unread,
May 5, 2009, 7:30:22 AM5/5/09
to
Hi Volker,

Thanks for the reply.
I want basic file locking work as expected. ( i.e. I want to prevent files from getting corrupted while shared across multiple platforms).
If some file is opened writing in one client, other clients should not be able to write in to it.

My server failing in many scenarios, I could explain one of the scenario as follows.

1. Opened a share using browser in Win XP machine.
2. Mounted same share in a Linux machine through nfs.
3. Initiated a 1 GB file transfer to share in windows
4. Same time tried to copy a file with same name in nfs share.It asked to overwrite existing file( I expect it not to start copy as write lock of that file is being obtained by CIFS client)
5. After a while both the transfers finished. MD5SUM showed resultant file got corrupted.

I would like to know best possible file locking options which will prevent files being corrupted while sharing across multiple platform / multiple protocols

Thanks
Anoop

Volker Lendecke

unread,
May 5, 2009, 8:20:16 AM5/5/09
to
On Tue, May 05, 2009 at 04:27:30AM -0700, Anoop P.A. wrote:
> Hi Volker,
>
> Thanks for the reply.
> I want basic file locking work as expected. ( i.e. I want to prevent files from getting corrupted while shared across multiple platforms).
> If some file is opened writing in one client, other clients should not be able to write in to it.
>
> My server failing in many scenarios, I could explain one of the scenario as follows.
>
> 1. Opened a share using browser in Win XP machine.
> 2. Mounted same share in a Linux machine through nfs.
> 3. Initiated a 1 GB file transfer to share in windows
> 4. Same time tried to copy a file with same name in nfs share.It asked to overwrite existing file( I expect it not to start copy as write lock of that file is being obtained by CIFS client)
> 5. After a while both the transfers finished. MD5SUM showed resultant file got corrupted.

No way you will achieve this cross-protocol. Unix just does
not know how to lock a complete file like Windows/CIFS does
using share modes. Your only chance is to only use Samba and
a cifs client file system and ditch NFS and local file
access.

Volker

Anoop P.A.

unread,
May 6, 2009, 2:40:14 AM5/6/09
to

Hi list,

Any body implemented cross protocol file locking before? Any pointer
will help me a lot

Hi Volker,

CIFS -> CIFS locking is not working as expected. It failed for me in
following scenario.

1. Opened a share using browser in Win XP machine.

2. Copied a word document (*.doc) to share.
3. Mounted CIFS share in a Ubuntu (8.04 LTS desktop).
4. Opened word document from Ubuntu using openoffice 2.4
5. Tried to open same file in Win XP but it didn't open and got error
message "No proper file permission" (I expect word document to open in
read only mode).

However if I open document first in Win XP and then using Open office
working as expected i.e. Document getting opened in read only mode.

Thanks
Anoop

> -----Original Message-----
> From: Volker Lendecke [mailto:Volker....@SerNet.DE]
> Sent: Tuesday, May 05, 2009 5:19 PM
> To: Anoop P.A.
> Cc: sa...@lists.samba.org
> Subject: Re: [Samba] file locking options in smb.conf
>

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

Volker Lendecke

unread,
May 6, 2009, 3:20:11 AM5/6/09
to
On Tue, May 05, 2009 at 11:35:54PM -0700, Anoop P.A. wrote:
>
> Hi list,
>
> Any body implemented cross protocol file locking before? Any pointer
> will help me a lot
>
> Hi Volker,
>
> CIFS -> CIFS locking is not working as expected. It failed for me in
> following scenario.
>
> 1. Opened a share using browser in Win XP machine.
> 2. Copied a word document (*.doc) to share.
> 3. Mounted CIFS share in a Ubuntu (8.04 LTS desktop).
> 4. Opened word document from Ubuntu using openoffice 2.4
> 5. Tried to open same file in Win XP but it didn't open and got error
> message "No proper file permission" (I expect word document to open in
> read only mode).
>
> However if I open document first in Win XP and then using Open office
> working as expected i.e. Document getting opened in read only mode.

Well, that's because Unix does not know about so-called
share modes that Microsoft Office uses. OpenOffice 3 will
solve this cross-platform using a lock file, so if you are
using that on both Windows and Linux it should work fine.

Volker

Daniel Müller

unread,
May 6, 2009, 5:10:11 AM5/6/09
to
Dear all,

It is the same problem with me. I run samba 3.2.8 on suse 10.2 .
Now and then we have trouble concerning the home directories
writing Word and Excel files.

My smb.conf for homes:

[homes]
##mit dem preexec befehl wird das userverzeichnis erstellt
root preexec=/windows/./userverzeichnis %U
root postexec=/windows/./bshares %U
comment=Heimatverzeichnis %U
msdfs root=yes
path= /windows/winuser/%U
valid users=%S
inherit permissions=yes
inherit owner=yes
force group= "Domain Users"
read only=no
create mask= 0750
directory mask=0775
browseable=no
hide files=/Desktop.ini/Thumbs.db/lost+found/desktop.ini
veto oplock
files=/*.pdf/*.PST/*.pst/*.doc/*.xls/*.docx/*.mdb/*.MDB/*.dbf/*.DBF/*.ppt/*.
xlsx/
#vfs objects=extd_audit,recycle
vfs objects=recycle
recycle:exclude= *.tmp,*.temp,*.log,*.ldb,*.TMP,?~$*,~$*
recycle:keeptree=Yes
recycle:exclude_dir=tmp,temp,profile,.profile
recycle:touch_mtime=yes
recycle:versions=Yes

When the error occurs the word or excel file is suddenly owned mask
administrators. And the user changed it cannot save it any more. There are
from this moment on many temp files around this files.
Only after deleting the admins mask ownership, and the temp files by hand
the word, excel files will be
Writeable again.
On our old samba 2.2.7 still running we do not have this trouble (the same
windows versions, the same office versions!!!).

-----------------------------------------------
EDV Daniel Müller

Leitung EDV
Tropenklinik Paul-Lechler-Krankenhaus
Paul-Lechler-Str. 24
72076 Tübingen

Tel.: 07071/206-463, Fax: 07071/206-499
eMail: mue...@tropenklinik.de
Internet: www.tropenklinik.de
-----------------------------------------------
-----Ursprüngliche Nachricht-----
Von: samba-bounces+mueller=tropenk...@lists.samba.org
[mailto:samba-bounces+mueller=tropenk...@lists.samba.org] Im Auftrag
von Anoop P.A.
Gesendet: Mittwoch, 6. Mai 2009 08:36
An: Volker....@SerNet.DE
Cc: sa...@lists.samba.org
Betreff: RE: [Samba] file locking options in smb.conf

0 new messages