LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-16-2008, 12:57 AM   #1
neel.gurjar
LQ Newbie
 
Registered: Apr 2008
Posts: 20

Rep: Reputation: 0
Problem in Samba on Linux about locking the files


I have configured file server CentOs 5, samba version 3.0.26a. Data is stored on that Server and users are accessing it from Windows clients and some users are accessing that data from Linux Clients with NFS.

I am facing one following problem:

Case 1 - 1st User open one excel file in windows client at the same time 2nd user open same file on Linux with OpenOffice. 2nd user get it in Read Only mode. This is good.

Case 2 - When both the users open same excel sheet at windows clients or linux clients, one user get Read Only. This is also good.

Case 3- If 2nd user open that file first in Linux and then 1st user open it in windows then both users get it writable. Which is not acceptable by users.

So I put "locking = yes" in smb.conf. and restarted smb.

After this change user open that file in first in Linux. Now this time when I try to open that file in windows it shows "Cannot access: access denied".
This is ok but here User want to see that file "Read Only" as it happens in in above case-1.

How can I do that ? Please help


[test]
path = /home/<user>
browseable = yes
volume = test
force group = windows
force user = <user>
comment = testing
locking=yes
--
Thanks
Neelesh
 
Old 04-16-2008, 02:47 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Quote:
Originally Posted by Samba 3 HOWTO & Reference Guide
17.2.1.2 Multiple-Accessed Shares or Files
As each additional user accesses a file in a share with oplocks enabled, the po-
tential for delays and resulting perceived poor performance increases. When
multiple users are accessing a file on a share that has oplocks enabled, the
management impact of sending and receiving oplock breaks and the result-
ing latency while other clients wait for the caching client to flush data offset
the performance gains of the caching user.
As each additional client attempts to access a file with oplocks set, the
potential performance improvement is negated and eventually results in a
performance bottleneck.
17.2.1.3 UNIX or NFS Client-Accessed Files
Local UNIX and NFS clients access files without a mandatory file-locking
mechanism. Thus, these client platforms are incapable of initiating an oplock
break request from the server to a Windows client that has a file cached.
Local UNIX or NFS file access can therefore write to a file that has been
cached by a Windows client, which exposes the file to likely data corruption.
If files are shared between Windows clients and either local UNIX or NFS
users, turn oplocks off.
What you are seeing may be the best you can get. Windows loads in the entire file and locks are a mechanism whether the client will be allowed to save the file back. Linux/Unix locks a range of bytes on the filesystem. The client program may not be written properly as well. I remember Jeremy Allison in an interview mentioning that this is an area that is the focus of a lot of work. So you may want to look in the README file on your system, there may be further info on recent oplock changes. There may be subtle differences between different Windows clients as well.

Also read through Section 17 of the Samba 3 HOWTO & Reference Guide ( the samba-doc package supplies it ) and maybe check the samba3.org website for any recent version changes. Perhaps monitor a samba mailing list as well.


Using "Force User" may also cause a problem.
Quote:
17.2.1.7 Beware of Force User
Samba includes an smb.conf parameter called force user that changes the
user accessing a share from the incoming user to whatever user is defined by
the smb.conf variable. If oplocks is enabled on a share, the change in user
access causes an oplock break to be sent to the client, even if the user has
not explicitly loaded a file. In cases where the network is slow or unreliable,
an oplock break can become lost without the user even accessing a file.
This can cause apparent performance degradation as the client continually
reconnects to overcome the lost oplock break.
Avoid the combination of the following:
• force user in the smb.conf share configuration.
• Slow or unreliable networks.
• Oplocks enabled.

Last edited by jschiwal; 04-16-2008 at 02:56 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
File Locking not working from Linux via Samba to Win marisdembovskis Linux - Networking 0 06-08-2006 07:59 AM
file locking problem with samba mpriddy Linux - Software 4 11-29-2004 04:00 PM
Samba File share locking problem Adam_equip Linux - Software 3 07-14-2004 09:14 AM
samba 3.0 locking ash4stuff Linux - Software 0 04-04-2004 04:50 AM
File locking over Samba rtaft Linux - Software 0 12-30-2003 11:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration