LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 07-14-2009, 04:23 AM   #1
humbletech99
Member
 
Registered: Jun 2005
Posts: 374

Rep: Reputation: 30
Samba - prevent locking of selected files over network?


I have a samba server which is serving a mixture of files. One main application uses a data file and creates a temporary working execution file at startup and holds that temp execution file open for the duration of the program's execution (but doesn't use the file at all after initial startup).

The problem is when a second user wants to run the application (and they all do) they cannot create/replace the temp file because it is file locked over the network by the other running copy of the application, despite the application not using it any more. The application is a long running program, we're talking hours at a time.

This results in us having to remove the file from the unix file system manually at user request so the next user using the application against the share succeeds in creating the temp file and starting up.

So the question is, is it possible to selectively disable file locking over the network in samba (preferably by regex)
 
Old 07-15-2009, 05:41 PM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
I believe that the better approach is to look at the application. Why is it creating the lock file? (That's what this sort of thing is called. It's an old UNIX technique for file sharing.) The lock file could be trying to protect a data file. If that is the case then removing the lock file by hand to allow additional instances of the application to access the same shared directory could be a mistake. You could be courting data corruption.

If that is not the case then why was the application designed to create this lock file?

If deleting the lock file is totally harmless then maybe you could configure the application to stop creating the file or to create the file on the client where it is running. Find out if it is using an environment variable to determine the location of the lock file. Maybe you could manipulate that such as defining it readonly to point to a local directory such as $HOME/tmp.
Code:
# FILE: .bashrc
readonly TMP=$HOME/tmp
export TMP
You may be able to do something similar with whatever environment variable this application uses, if any.

If the location of the lock file is hard coded into the application then this approach won't work. In that case I would again suggest that you consider whether this lock file may be doing something useful. If the lock file is not doing anything useful then the application designer made a strange decision.
 
Old 07-16-2009, 04:46 AM   #3
humbletech99
Member
 
Registered: Jun 2005
Posts: 374

Original Poster
Rep: Reputation: 30
It's not a unix app and it's not a lock file. It's a windows app running on a file over a samba share and creating a program execution plan file next to the file it is using. The file is not needed after the initial startup of the long running process.

Hence why we go and delete it from the unix side so a different client can start the program on the same file...

Data corruption is not an issue in this case.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Prevent root from deleting files on network mounts bobwall Linux - Server 9 08-28-2008 07:31 PM
Problem in Samba on Linux about locking the files neel.gurjar Linux - Server 1 04-16-2008 02:47 AM
How to prevent cvs from locking. Ratclaws Linux - Software 0 09-22-2005 10:30 AM
Samba Package cant be selected zappos Linux - Newbie 4 03-17-2005 03:34 AM
Can someone tell me what services need to be selected for auto-startup for Samba fs? RedHatMasta Linux - Networking 5 02-02-2004 04:09 PM


All times are GMT -5. The time now is 06:28 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration