Sign in to follow this  
BeanDog

Weird samba file locking problem

Recommended Posts

I use a Linux (CentOS/RHEL 4) virtual machine as a development web server. I used to map a drive on my Windows development machine to the vhosts directory on the VM, and edit files directly there. However, as my project grew to several thousand files, performance on project-wide searches and subversion operations really took a hit. So I decided to reverse roles. I shared a folder on my Windows machine, mounted it using Samba on the VM, and pointed Apache there for my code. This did in fact solve all my speed issues, and there's no noticeable difference in performance of the web app with it loading the PHP files over the network over Samba. There's a problem: Once I execute a script on a vhost, the .htaccess file in the root directory of that vhost gets locked, according to Windows. I can not edit or rename the .htaccess file, though I can read it. Process Explorer shows no processes with locks on the file. smbstatus on the VM shows the Samba has no outstanding file locks (though that might be talking about the shares the VM has set up, rather than the ones it's connecting to on my Windows box?) I can edit the .htaccess file from the VM (using emacs, saving it onto the shared folder) despite not being able to edit the file using Windows (where the file is actually stored, or using \\compname\vhosts\project\.htaccess to access it over file sharing). Stopping Apache does not release the lock. I can only get that lock released by unmounting the share in the Linux VM. As soon as I re-mount it and run a script, the .htaccess file gets locked again. Any idea what's going on here?

Share this post


Link to post
Share on other sites
I'm not certain this is the same problem, but I had a similar issue recently while accessing a SQLite database on a Samba share with Windows. These two posts helped:
link1 (last post, which has the following link)
link2

The short answer: try mounting the share with the nobrl option.

[Edited by - DrTwox on August 18, 2008 7:25:44 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this